summaryrefslogtreecommitdiff
path: root/crypto-pgpainless/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'crypto-pgpainless/src/test')
-rw-r--r--crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt12
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt b/crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt
index 5c2ee7ef..b491206b 100644
--- a/crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt
+++ b/crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt
@@ -2,6 +2,7 @@ package app.passwordstore.crypto
import app.passwordstore.crypto.GpgIdentifier.KeyId
import app.passwordstore.crypto.GpgIdentifier.UserId
+import app.passwordstore.crypto.KeyUtils.tryGetId
import app.passwordstore.crypto.errors.KeyAlreadyExistsException
import app.passwordstore.crypto.errors.KeyNotFoundException
import app.passwordstore.crypto.errors.NoKeysAvailableException
@@ -93,13 +94,12 @@ class PGPKeyManagerTest {
// Add key using KeyManager
keyManager.addKey(secretKey).unwrap()
- // Check if the key id returned is correct
- val keyId = keyManager.getKeyId(keyManager.removeKey(secretKey).unwrap())
- assertEquals(KeyId(CryptoConstants.KEY_ID), keyId)
+ // Remove key
+ keyManager.removeKey(tryGetId(secretKey)!!).unwrap()
- // Check if the keys directory have 0 files
- val keysDir = File(filesDir, PGPKeyManager.KEY_DIR_NAME)
- assertEquals(0, keysDir.list()?.size)
+ // Check that no keys remain
+ val keys = keyManager.getAllKeys().unwrap()
+ assertEquals(0, keys.size)
}
@Test