aboutsummaryrefslogtreecommitdiff
path: root/app/src/androidTest/java
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-05-28 22:42:13 +0530
committerGitHub <noreply@github.com>2020-05-28 22:42:13 +0530
commite7463ec24c929860f0a7311b558f496919d54d20 (patch)
treeeb460f7e49e1a71acaceaec305e511bb4c0a9d45 /app/src/androidTest/java
parentffcbabc2f4ef9766271be5335cec1869fe634646 (diff)
Remove HOTP/TOTP support (#806)
Diffstat (limited to 'app/src/androidTest/java')
-rw-r--r--app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.kt104
1 files changed, 0 insertions, 104 deletions
diff --git a/app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.kt b/app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.kt
deleted file mode 100644
index 5feb5aaf..00000000
--- a/app/src/androidTest/java/com/zeapo/pwdstore/PasswordEntryTest.kt
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
- * SPDX-License-Identifier: GPL-3.0-only
- */
-package com.zeapo.pwdstore
-
-import org.junit.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertNull
-import kotlin.test.assertTrue
-
-class PasswordEntryTest {
- @Test fun testGetPassword() {
- assertEquals("fooooo", PasswordEntry("fooooo\nbla\n").password)
- assertEquals("fooooo", PasswordEntry("fooooo\nbla").password)
- assertEquals("fooooo", PasswordEntry("fooooo\n").password)
- assertEquals("fooooo", PasswordEntry("fooooo").password)
- assertEquals("", PasswordEntry("\nblubb\n").password)
- assertEquals("", PasswordEntry("\nblubb").password)
- assertEquals("", PasswordEntry("\n").password)
- assertEquals("", PasswordEntry("").password)
- }
-
- @Test fun testGetExtraContent() {
- assertEquals("bla\n", PasswordEntry("fooooo\nbla\n").extraContent)
- assertEquals("bla", PasswordEntry("fooooo\nbla").extraContent)
- assertEquals("", PasswordEntry("fooooo\n").extraContent)
- assertEquals("", PasswordEntry("fooooo").extraContent)
- assertEquals("blubb\n", PasswordEntry("\nblubb\n").extraContent)
- assertEquals("blubb", PasswordEntry("\nblubb").extraContent)
- assertEquals("", PasswordEntry("\n").extraContent)
- assertEquals("", PasswordEntry("").extraContent)
- }
-
- @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)
- assertEquals(
- "username",
- 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)
- }
-
- @Test fun testHasUsername() {
- assertTrue(PasswordEntry("secret\nextra\nlogin: username\ncontent\n").hasUsername())
- assertFalse(PasswordEntry("secret\nextra\ncontent\n").hasUsername())
- assertFalse(PasswordEntry("secret\nlogin failed\n").hasUsername())
- assertFalse(PasswordEntry("\n").hasUsername())
- assertFalse(PasswordEntry("").hasUsername())
- }
-
- @Test fun testNoTotpUriPresent() {
- val entry = PasswordEntry("secret\nextra\nlogin: username\ncontent")
- assertFalse(entry.hasTotp())
- assertNull(entry.totpSecret)
- }
-
- @Test fun testTotpUriInPassword() {
- val entry = PasswordEntry("otpauth://totp/test?secret=JBSWY3DPEHPK3PXP")
- assertTrue(entry.hasTotp())
- assertEquals("JBSWY3DPEHPK3PXP", entry.totpSecret)
- }
-
- @Test fun testTotpUriInContent() {
- val entry = PasswordEntry(
- "secret\nusername: test\notpauth://totp/test?secret=JBSWY3DPEHPK3PXP")
- assertTrue(entry.hasTotp())
- assertEquals("JBSWY3DPEHPK3PXP", entry.totpSecret)
- }
-
- @Test fun testNoHotpUriPresent() {
- val entry = PasswordEntry("secret\nextra\nlogin: username\ncontent")
- assertFalse(entry.hasHotp())
- assertNull(entry.hotpSecret)
- assertNull(entry.hotpCounter)
- }
-
- @Test fun testHotpUriInPassword() {
- val entry = PasswordEntry("otpauth://hotp/test?secret=JBSWY3DPEHPK3PXP&counter=25")
- assertTrue(entry.hasHotp())
- assertEquals("JBSWY3DPEHPK3PXP", entry.hotpSecret)
- assertEquals(25, entry.hotpCounter)
- }
-
- @Test fun testHotpUriInContent() {
- val entry = PasswordEntry(
- "secret\nusername: test\notpauth://hotp/test?secret=JBSWY3DPEHPK3PXP&counter=25")
- assertTrue(entry.hasHotp())
- assertEquals("JBSWY3DPEHPK3PXP", entry.hotpSecret)
- assertEquals(25, entry.hotpCounter)
- }
-}