aboutsummaryrefslogtreecommitdiff
path: root/app/src/androidTest/java
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-05-06 01:58:05 +0530
committerGitHub <noreply@github.com>2020-05-06 01:58:05 +0530
commitfeab56994d874df21f68eeddfca8d8a7ecbf75d2 (patch)
treed940093f1c27f6227cab0349153edb145291f171 /app/src/androidTest/java
parentf99a14d95b7f9df482585f043ce1263662e66132 (diff)
PasswordEntry: add more potential fields for username (#764)
Diffstat (limited to 'app/src/androidTest/java')
-rw-r--r--app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.kt7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.kt b/app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.kt
index 2f7028a4..cdc822e5 100644
--- a/app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.kt
+++ b/app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.kt
@@ -34,6 +34,10 @@ class PasswordEntryTest {
}
@Test fun testGetUsername() {
+ for (field in PasswordEntry.USERNAME_FIELDS) {
+ assertEquals("username", PasswordEntry("\n$field username").username)
+ assertEquals("username", PasswordEntry("\n${field.toUpperCase()} username").username)
+ }
assertEquals(
"username",
PasswordEntry("secret\nextra\nlogin: username\ncontent\n").username)
@@ -42,6 +46,9 @@ class PasswordEntryTest {
PasswordEntry("\nextra\nusername: username\ncontent\n").username)
assertEquals(
"username", PasswordEntry("\nUSERNaMe: username\ncontent\n").username)
+ assertEquals("username", PasswordEntry("\nlogin: username").username)
+ assertEquals("foo@example.com", PasswordEntry("\nemail: foo@example.com").username)
+ assertEquals("username", PasswordEntry("\nidentity: username\nlogin: another_username").username)
assertEquals("username", PasswordEntry("\nLOGiN:username").username)
assertNull(PasswordEntry("secret\nextra\ncontent\n").username)
}