summaryrefslogtreecommitdiff
path: root/crypto-pgpainless/src/test
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2023-07-05 02:40:31 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2023-07-05 02:40:31 +0530
commit0c8bed4e546ac248be118b41cfa4b002a357e12f (patch)
tree95445712c7a2531c17bd32ffec28447eff557125 /crypto-pgpainless/src/test
parent66a9c884486d016dceabeee8b929dc31696bd23a (diff)
feat(crypto-pgpainless): run usability test when adding keys
Diffstat (limited to 'crypto-pgpainless/src/test')
-rw-r--r--crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt8
1 files changed, 8 insertions, 0 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 43a62bd7..85cf8e1b 100644
--- a/crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt
+++ b/crypto-pgpainless/src/test/kotlin/app/passwordstore/crypto/PGPKeyManagerTest.kt
@@ -6,6 +6,7 @@ import app.passwordstore.crypto.PGPIdentifier.UserId
import app.passwordstore.crypto.errors.KeyAlreadyExistsException
import app.passwordstore.crypto.errors.KeyNotFoundException
import app.passwordstore.crypto.errors.NoKeysAvailableException
+import app.passwordstore.crypto.errors.UnusableKeyException
import com.github.michaelbull.result.Err
import com.github.michaelbull.result.Ok
import com.github.michaelbull.result.unwrap
@@ -71,6 +72,13 @@ class PGPKeyManagerTest {
}
@Test
+ fun addKeyWithUnusableKey() =
+ runTest(dispatcher) {
+ val error = keyManager.addKey(PGPKey(TestUtils.getAEADSecretKey())).unwrapError()
+ assertEquals(UnusableKeyException, error)
+ }
+
+ @Test
fun removeKey() =
runTest(dispatcher) {
// Add key using KeyManager