fix: follow undergraduate login links and capture live history URLs
This commit is contained in:
@@ -6,6 +6,51 @@ import 'package:hepan_everyday/features/school/undergraduate/page_probe.dart';
|
||||
|
||||
void main() {
|
||||
final uri = Uri.parse('https://eams.uestc.edu.cn/eams/');
|
||||
test(
|
||||
'legacy HTTP continuation upgrade is limited to the exact school system',
|
||||
() {
|
||||
expect(
|
||||
UndergraduateNavigationPolicy.secureIdentityRedirect(
|
||||
Uri.parse(
|
||||
'http://eams.uestc.edu.cn/eams/home.action?login=1&next=%2Feams%2F#continue',
|
||||
),
|
||||
).toString(),
|
||||
'https://eams.uestc.edu.cn/eams/home.action?login=1&next=%2Feams%2F#continue',
|
||||
);
|
||||
for (final address in [
|
||||
'http://eams.uestc.edu.cn.attacker.test/eams/home.action',
|
||||
'http://user@eams.uestc.edu.cn/eams/home.action',
|
||||
'http://eams.uestc.edu.cn:8080/eams/home.action',
|
||||
'http://eams.uestc.edu.cn/other/action',
|
||||
]) {
|
||||
expect(
|
||||
UndergraduateNavigationPolicy.secureIdentityRedirect(
|
||||
Uri.parse(address),
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
test(
|
||||
'decoder still requires captured URL to match the live document URL',
|
||||
() {
|
||||
expect(
|
||||
() => UndergraduatePageEvidence.decode({
|
||||
'topUrl': 'https://eams.uestc.edu.cn/eams/courseTableForStd.action?semester.id=523',
|
||||
'authenticated': true,
|
||||
'pages': [
|
||||
{
|
||||
'kind': 'timetable',
|
||||
'url': 'https://eams.uestc.edu.cn/eams/courseTableForStd.action?semester.id=523',
|
||||
'html': 'table',
|
||||
},
|
||||
],
|
||||
}, uri),
|
||||
throwsFormatException,
|
||||
);
|
||||
},
|
||||
);
|
||||
test(
|
||||
'navigation and capture distinguish official data from authentication',
|
||||
() {
|
||||
|
||||
Reference in New Issue
Block a user