aboutsummaryrefslogtreecommitdiff
path: root/app/src/test/java/dev/msfjarvis
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-12-21 01:42:42 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2021-12-21 13:01:42 +0530
commit17860407f9451b3ac90caa1fc20a10cfd4c44489 (patch)
treea717a4fb5385e1d98fd7e65f08b89ad607831dfd /app/src/test/java/dev/msfjarvis
parenta0a8200393671f92d7d587750d01cf7915f4d2b8 (diff)
app: migrate XkPasswd users to Diceware
Diffstat (limited to 'app/src/test/java/dev/msfjarvis')
-rw-r--r--app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt b/app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt
index c37eb626..d279ab03 100644
--- a/app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt
+++ b/app/src/test/java/dev/msfjarvis/aps/util/settings/MigrationsTest.kt
@@ -155,4 +155,32 @@ class MigrationsTest {
assertEquals(true, sharedPrefs.getBoolean(PreferenceKeys.CLEAR_CLIPBOARD_HISTORY, false))
assertFalse(sharedPrefs.contains(PreferenceKeys.CLEAR_CLIPBOARD_20X))
}
+
+ @Test
+ fun verifyClassicPasswordGeneratorMigration() {
+ sharedPrefs.edit {
+ clear()
+ putString(PreferenceKeys.PREF_KEY_PWGEN_TYPE, "classic")
+ }
+ runMigrations(
+ filesDir,
+ sharedPrefs,
+ GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir),
+ )
+ assertEquals("classic", sharedPrefs.getString(PreferenceKeys.PREF_KEY_PWGEN_TYPE))
+ }
+
+ @Test
+ fun verifyXkPasswdPasswordGeneratorMigration() {
+ sharedPrefs.edit {
+ clear()
+ putString(PreferenceKeys.PREF_KEY_PWGEN_TYPE, "xkpasswd")
+ }
+ runMigrations(
+ filesDir,
+ sharedPrefs,
+ GitSettings(sharedPrefs, encryptedSharedPreferences, proxySharedPreferences, filesDir),
+ )
+ assertEquals("diceware", sharedPrefs.getString(PreferenceKeys.PREF_KEY_PWGEN_TYPE))
+ }
}