|
@@ -3,7 +3,7 @@ import 'package:flutter_test/flutter_test.dart';
|
|
|
|
|
|
void main() {
|
|
void main() {
|
|
test("parseCodeFromRawData", () {
|
|
test("parseCodeFromRawData", () {
|
|
- final code1 = Code.fromRawData(
|
|
|
|
|
|
+ final code1 = Code.fromOTPAuthUrl(
|
|
"otpauth://totp/example%20finance%3Aee%40ff.gg?secret=ASKZNWOU6SVYAMVS",
|
|
"otpauth://totp/example%20finance%3Aee%40ff.gg?secret=ASKZNWOU6SVYAMVS",
|
|
);
|
|
);
|
|
expect(code1.issuer, "example finance", reason: "issuerMismatch");
|
|
expect(code1.issuer, "example finance", reason: "issuerMismatch");
|
|
@@ -12,7 +12,7 @@ void main() {
|
|
});
|
|
});
|
|
|
|
|
|
test("parseDocumentedFormat", () {
|
|
test("parseDocumentedFormat", () {
|
|
- final code = Code.fromRawData(
|
|
|
|
|
|
+ final code = Code.fromOTPAuthUrl(
|
|
"otpauth://totp/testdata@ente.io?secret=ASKZNWOU6SVYAMVS&issuer=GitHub",
|
|
"otpauth://totp/testdata@ente.io?secret=ASKZNWOU6SVYAMVS&issuer=GitHub",
|
|
);
|
|
);
|
|
expect(code.issuer, "GitHub", reason: "issuerMismatch");
|
|
expect(code.issuer, "GitHub", reason: "issuerMismatch");
|
|
@@ -21,7 +21,7 @@ void main() {
|
|
});
|
|
});
|
|
|
|
|
|
test("validateCount", () {
|
|
test("validateCount", () {
|
|
- final code = Code.fromRawData(
|
|
|
|
|
|
+ final code = Code.fromOTPAuthUrl(
|
|
"otpauth://hotp/testdata@ente.io?secret=ASKZNWOU6SVYAMVS&issuer=GitHub&counter=15",
|
|
"otpauth://hotp/testdata@ente.io?secret=ASKZNWOU6SVYAMVS&issuer=GitHub&counter=15",
|
|
);
|
|
);
|
|
expect(code.issuer, "GitHub", reason: "issuerMismatch");
|
|
expect(code.issuer, "GitHub", reason: "issuerMismatch");
|
|
@@ -32,7 +32,7 @@ void main() {
|
|
//
|
|
//
|
|
|
|
|
|
test("parseWithFunnyAccountName", () {
|
|
test("parseWithFunnyAccountName", () {
|
|
- final code = Code.fromRawData(
|
|
|
|
|
|
+ final code = Code.fromOTPAuthUrl(
|
|
"otpauth://totp/Mongo Atlas:Acc !@#444?algorithm=sha1&digits=6&issuer=Mongo Atlas&period=30&secret=NI4CTTFEV4G2JFE6",
|
|
"otpauth://totp/Mongo Atlas:Acc !@#444?algorithm=sha1&digits=6&issuer=Mongo Atlas&period=30&secret=NI4CTTFEV4G2JFE6",
|
|
);
|
|
);
|
|
expect(code.issuer, "Mongo Atlas", reason: "issuerMismatch");
|
|
expect(code.issuer, "Mongo Atlas", reason: "issuerMismatch");
|
|
@@ -43,11 +43,11 @@ void main() {
|
|
test("parseAndUpdateInChinese", () {
|
|
test("parseAndUpdateInChinese", () {
|
|
const String rubberDuckQr =
|
|
const String rubberDuckQr =
|
|
'otpauth://totp/%E6%A9%A1%E7%9A%AE%E9%B8%AD?secret=2CWDCK4EOIN5DJDRMYUMYBBO4MKSR5AX&issuer=ente.io';
|
|
'otpauth://totp/%E6%A9%A1%E7%9A%AE%E9%B8%AD?secret=2CWDCK4EOIN5DJDRMYUMYBBO4MKSR5AX&issuer=ente.io';
|
|
- final code = Code.fromRawData(rubberDuckQr);
|
|
|
|
|
|
+ final code = Code.fromOTPAuthUrl(rubberDuckQr);
|
|
expect(code.account, '橡皮鸭');
|
|
expect(code.account, '橡皮鸭');
|
|
final String updatedRawCode =
|
|
final String updatedRawCode =
|
|
code.copyWith(account: '伍迪', issuer: '鸭子').rawData;
|
|
code.copyWith(account: '伍迪', issuer: '鸭子').rawData;
|
|
- final updateCode = Code.fromRawData(updatedRawCode);
|
|
|
|
|
|
+ final updateCode = Code.fromOTPAuthUrl(updatedRawCode);
|
|
expect(updateCode.account, '伍迪', reason: 'updated accountMismatch');
|
|
expect(updateCode.account, '伍迪', reason: 'updated accountMismatch');
|
|
expect(updateCode.issuer, '鸭子', reason: 'updated issuerMismatch');
|
|
expect(updateCode.issuer, '鸭子', reason: 'updated issuerMismatch');
|
|
});
|
|
});
|