mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
Avoid code duplication
This commit is contained in:
parent
0559911f39
commit
3600e374f2
1 changed files with 6 additions and 15 deletions
|
@ -122,27 +122,18 @@ class LegacyPinCodeMigratorTests {
|
|||
|
||||
@Test
|
||||
fun migratePinCodeM() = runTest {
|
||||
val pinCode = "1234"
|
||||
buildVersionSdkIntProvider.value = Build.VERSION_CODES.M
|
||||
saveLegacyPinCode(pinCode)
|
||||
|
||||
legacyPinCodeMigrator.migrate()
|
||||
|
||||
coVerify { legacyPinCodeMigrator.getDecryptedPinCode() }
|
||||
verify { secretStoringUtils.securelyStoreBytes(any(), any()) }
|
||||
coVerify { pinCodeStore.savePinCode(any()) }
|
||||
verify { keyStore.deleteEntry(LEGACY_PIN_CODE_KEY_ALIAS) }
|
||||
|
||||
val decodedPinCode = String(secretStoringUtils.loadSecureSecretBytes(Base64.decode(pinCodeStore.getPinCode().orEmpty(), Base64.NO_WRAP), alias))
|
||||
decodedPinCode shouldBeEqualTo pinCode
|
||||
keyStore.containsAlias(LEGACY_PIN_CODE_KEY_ALIAS) shouldBe false
|
||||
keyStore.containsAlias(alias) shouldBe true
|
||||
migratePinCode()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun migratePinCodeL() = runTest {
|
||||
val pinCode = "1234"
|
||||
buildVersionSdkIntProvider.value = Build.VERSION_CODES.LOLLIPOP
|
||||
migratePinCode()
|
||||
}
|
||||
|
||||
private suspend fun migratePinCode() {
|
||||
val pinCode = "1234"
|
||||
saveLegacyPinCode(pinCode)
|
||||
|
||||
legacyPinCodeMigrator.migrate()
|
||||
|
|
Loading…
Reference in a new issue