summaryrefslogtreecommitdiff
path: root/app/src/test/java
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-11-06 10:50:34 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2020-12-21 20:16:42 +0530
commitda8ca8b46d5d842670c9400c9a55b181eceb10b2 (patch)
tree79d3392614fc7718dba804e4abdcc5b4873a9f93 /app/src/test/java
parent7aee68f1fa60c4565361883511cd4eb490bc4929 (diff)
Fix extra content for multiple username fields (#1192)
Fixes #1190 Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> (cherry picked from commit df6ebfee27597887075b94a945e707ecd69decb1)
Diffstat (limited to 'app/src/test/java')
-rw-r--r--app/src/test/java/com/zeapo/pwdstore/model/PasswordEntryTest.kt11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/src/test/java/com/zeapo/pwdstore/model/PasswordEntryTest.kt b/app/src/test/java/com/zeapo/pwdstore/model/PasswordEntryTest.kt
index 04c606e8..082fc110 100644
--- a/app/src/test/java/com/zeapo/pwdstore/model/PasswordEntryTest.kt
+++ b/app/src/test/java/com/zeapo/pwdstore/model/PasswordEntryTest.kt
@@ -116,6 +116,17 @@ class PasswordEntryTest {
assertFalse(entry.hasUsername())
}
+ // https://github.com/android-password-store/Android-Password-Store/issues/1190
+ @Test fun extraContentWithMultipleUsernameFields() {
+ val entry = makeEntry("pass\nuser: user\nid: id\n$TOTP_URI")
+ assertTrue(entry.hasExtraContent())
+ assertTrue(entry.hasTotp())
+ assertTrue(entry.hasUsername())
+ assertEquals("pass", entry.password)
+ assertEquals("user", entry.username)
+ assertEquals("id: id", entry.extraContentWithoutAuthData)
+ }
+
companion object {
const val TOTP_URI = "otpauth://totp/ACME%20Co:john@example.com?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=ACME%20Co&algorithm=SHA1&digits=6&period=30"