diff options
Diffstat (limited to 'app/src/androidTest')
4 files changed, 40 insertions, 24 deletions
diff --git a/app/src/androidTest/java/com/zeapo/pwdstore/DecryptTest.kt b/app/src/androidTest/java/com/zeapo/pwdstore/DecryptTest.kt index 448edc00..290f7a98 100644 --- a/app/src/androidTest/java/com/zeapo/pwdstore/DecryptTest.kt +++ b/app/src/androidTest/java/com/zeapo/pwdstore/DecryptTest.kt @@ -1,3 +1,7 @@ +/* + * Copyright © 2014-2019 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ package com.zeapo.pwdstore import android.annotation.SuppressLint @@ -11,6 +15,10 @@ import androidx.test.filters.LargeTest import androidx.test.platform.app.InstrumentationRegistry import androidx.test.rule.ActivityTestRule import com.zeapo.pwdstore.crypto.PgpActivity +import java.io.File +import java.io.FileOutputStream +import java.io.IOException +import java.nio.charset.StandardCharsets import kotlinx.android.synthetic.main.decrypt_layout.crypto_extra_show import kotlinx.android.synthetic.main.decrypt_layout.crypto_password_category_decrypt import kotlinx.android.synthetic.main.decrypt_layout.crypto_password_file @@ -23,11 +31,6 @@ import org.junit.Assert.assertNotNull import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -import java.io.File -import java.io.FileOutputStream -import java.io.IOException -import java.nio.charset.StandardCharsets - @RunWith(AndroidJUnit4::class) @LargeTest @@ -121,7 +124,7 @@ class DecryptTest { SystemClock.sleep(4000) // The clipboard should be cleared!! - for(i in 0..clipboard.primaryClip.itemCount) { + for (i in 0..clipboard.primaryClip.itemCount) { assertEquals("", clipboard.primaryClip.getItemAt(i).text) } @@ -161,8 +164,4 @@ class DecryptTest { } } } - } - - - diff --git a/app/src/androidTest/java/com/zeapo/pwdstore/EncryptTest.kt b/app/src/androidTest/java/com/zeapo/pwdstore/EncryptTest.kt index 1b164c63..a4bc2c04 100644 --- a/app/src/androidTest/java/com/zeapo/pwdstore/EncryptTest.kt +++ b/app/src/androidTest/java/com/zeapo/pwdstore/EncryptTest.kt @@ -1,3 +1,7 @@ +/* + * Copyright © 2014-2019 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ package com.zeapo.pwdstore import android.annotation.SuppressLint @@ -15,13 +19,12 @@ import androidx.test.filters.LargeTest import androidx.test.platform.app.InstrumentationRegistry import androidx.test.rule.ActivityTestRule import com.zeapo.pwdstore.crypto.PgpActivity +import java.io.File import org.apache.commons.io.FileUtils import org.apache.commons.io.IOUtils import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -import java.io.File - @RunWith(AndroidJUnit4::class) @LargeTest @@ -80,6 +83,3 @@ class EncryptTest { assert(File("$path/$name.gpg").exists()) } } - - - diff --git a/app/src/androidTest/java/com/zeapo/pwdstore/OtpTest.java b/app/src/androidTest/java/com/zeapo/pwdstore/OtpTest.java index 2cb04d2e..ec694167 100644 --- a/app/src/androidTest/java/com/zeapo/pwdstore/OtpTest.java +++ b/app/src/androidTest/java/com/zeapo/pwdstore/OtpTest.java @@ -1,7 +1,10 @@ +/* + * Copyright © 2014-2019 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ package com.zeapo.pwdstore; import com.zeapo.pwdstore.utils.Otp; - import junit.framework.TestCase; public class OtpTest extends TestCase { diff --git a/app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.java b/app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.java index 3763d1ab..7817c074 100644 --- a/app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.java +++ b/app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.java @@ -1,3 +1,7 @@ +/* + * Copyright © 2014-2019 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ package com.zeapo.pwdstore; import junit.framework.TestCase; @@ -27,9 +31,14 @@ public class PasswordEntryTest extends TestCase { } public void testGetUsername() { - assertEquals("username", new PasswordEntry("secret\nextra\nlogin: username\ncontent\n").getUsername()); - assertEquals("username", new PasswordEntry("\nextra\nusername: username\ncontent\n").getUsername()); - assertEquals("username", new PasswordEntry("\nUSERNaMe: username\ncontent\n").getUsername()); + assertEquals( + "username", + new PasswordEntry("secret\nextra\nlogin: username\ncontent\n").getUsername()); + assertEquals( + "username", + new PasswordEntry("\nextra\nusername: username\ncontent\n").getUsername()); + assertEquals( + "username", new PasswordEntry("\nUSERNaMe: username\ncontent\n").getUsername()); assertEquals("username", new PasswordEntry("\nLOGiN:username").getUsername()); assertNull(new PasswordEntry("secret\nextra\ncontent\n").getUsername()); } @@ -55,7 +64,9 @@ public class PasswordEntryTest extends TestCase { } public void testTotpUriInContent() { - PasswordEntry entry = new PasswordEntry("secret\nusername: test\notpauth://totp/test?secret=JBSWY3DPEHPK3PXP"); + PasswordEntry entry = + new PasswordEntry( + "secret\nusername: test\notpauth://totp/test?secret=JBSWY3DPEHPK3PXP"); assertTrue(entry.hasTotp()); assertEquals("JBSWY3DPEHPK3PXP", entry.getTotpSecret()); } @@ -68,16 +79,19 @@ public class PasswordEntryTest extends TestCase { } public void testHotpUriInPassword() { - PasswordEntry entry = new PasswordEntry("otpauth://hotp/test?secret=JBSWY3DPEHPK3PXP&counter=25"); + PasswordEntry entry = + new PasswordEntry("otpauth://hotp/test?secret=JBSWY3DPEHPK3PXP&counter=25"); assertTrue(entry.hasHotp()); assertEquals("JBSWY3DPEHPK3PXP", entry.getHotpSecret()); - assertEquals(new Long(25 ), entry.getHotpCounter()); + assertEquals(new Long(25), entry.getHotpCounter()); } public void testHotpUriInContent() { - PasswordEntry entry = new PasswordEntry("secret\nusername: test\notpauth://hotp/test?secret=JBSWY3DPEHPK3PXP&counter=25"); + PasswordEntry entry = + new PasswordEntry( + "secret\nusername: test\notpauth://hotp/test?secret=JBSWY3DPEHPK3PXP&counter=25"); assertTrue(entry.hasHotp()); assertEquals("JBSWY3DPEHPK3PXP", entry.getHotpSecret()); assertEquals(new Long(25), entry.getHotpCounter()); } -}
\ No newline at end of file +} |