From 53b9a807a19d62f11190f5fbe3405a870e16874d Mon Sep 17 00:00:00 2001 From: Joris Minjat Date: Fri, 23 Oct 2020 18:13:37 +0200 Subject: Minimal support for MIME secret encoding (#1170) Co-authored-by: Fabian Henneke (cherry picked from commit 38ece10e0dfdc907089b7ddc4e6c9d17e69013f3) --- app/src/test/java/com/zeapo/pwdstore/model/PasswordEntryTest.kt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/src/test/java') 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 6eecfe45..04c606e8 100644 --- a/app/src/test/java/com/zeapo/pwdstore/model/PasswordEntryTest.kt +++ b/app/src/test/java/com/zeapo/pwdstore/model/PasswordEntryTest.kt @@ -28,6 +28,12 @@ class PasswordEntryTest { assertEquals("", makeEntry("\nblubb").password) assertEquals("", makeEntry("\n").password) assertEquals("", makeEntry("").password) + for (field in PasswordEntry.PASSWORD_FIELDS) { + assertEquals("fooooo", makeEntry("\n$field fooooo").password) + assertEquals("fooooo", makeEntry("\n${field.toUpperCase()} fooooo").password) + assertEquals("fooooo", makeEntry("GOPASS-SECRET-1.0\n$field fooooo").password) + assertEquals("fooooo", makeEntry("someFirstLine\nUsername: bar\n$field fooooo").password) + } } @Test fun testGetExtraContent() { @@ -37,6 +43,9 @@ class PasswordEntryTest { assertEquals("", makeEntry("fooooo").extraContent) assertEquals("blubb\n", makeEntry("\nblubb\n").extraContent) assertEquals("blubb", makeEntry("\nblubb").extraContent) + assertEquals("blubb", makeEntry("blubb\npassword: foo").extraContent) + assertEquals("blubb", makeEntry("password: foo\nblubb").extraContent) + assertEquals("blubb\nusername: bar", makeEntry("blubb\npassword: foo\nusername: bar").extraContent) assertEquals("", makeEntry("\n").extraContent) assertEquals("", makeEntry("").extraContent) } -- cgit v1.2.3