mirror of
https://github.com/android-password-store/Android-Password-Store.git
synced 2025-09-06 04:51:38 +02:00
fix(crypto-pgpainless): pass test parameter directly where needed
Prevents unnecessary runs of tests that don't use the parameter
This commit is contained in:
parent
098d7047af
commit
56af2c936b
|
@ -2,6 +2,7 @@
|
||||||
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
* SPDX-License-Identifier: GPL-3.0-only
|
* SPDX-License-Identifier: GPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@file:Suppress("JUnitMalformedDeclaration") // The test runner takes care of it
|
||||||
|
|
||||||
package app.passwordstore.crypto
|
package app.passwordstore.crypto
|
||||||
|
|
||||||
|
@ -30,12 +31,11 @@ enum class EncryptionKey(val keySet: List<PGPKey>) {
|
||||||
@RunWith(TestParameterInjector::class)
|
@RunWith(TestParameterInjector::class)
|
||||||
class PGPainlessCryptoHandlerTest {
|
class PGPainlessCryptoHandlerTest {
|
||||||
|
|
||||||
@TestParameter private lateinit var encryptionKey: EncryptionKey
|
|
||||||
private val cryptoHandler = PGPainlessCryptoHandler()
|
private val cryptoHandler = PGPainlessCryptoHandler()
|
||||||
private val secretKey = PGPKey(TestUtils.getArmoredSecretKey())
|
private val secretKey = PGPKey(TestUtils.getArmoredSecretKey())
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun encryptAndDecrypt() {
|
fun encryptAndDecrypt(@TestParameter encryptionKey: EncryptionKey) {
|
||||||
val ciphertextStream = ByteArrayOutputStream()
|
val ciphertextStream = ByteArrayOutputStream()
|
||||||
val encryptRes =
|
val encryptRes =
|
||||||
cryptoHandler.encrypt(
|
cryptoHandler.encrypt(
|
||||||
|
@ -59,7 +59,7 @@ class PGPainlessCryptoHandlerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun decryptWithWrongPassphrase() {
|
fun decryptWithWrongPassphrase(@TestParameter encryptionKey: EncryptionKey) {
|
||||||
val ciphertextStream = ByteArrayOutputStream()
|
val ciphertextStream = ByteArrayOutputStream()
|
||||||
val encryptRes =
|
val encryptRes =
|
||||||
cryptoHandler.encrypt(
|
cryptoHandler.encrypt(
|
||||||
|
@ -83,7 +83,7 @@ class PGPainlessCryptoHandlerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun encryptAsciiArmored() {
|
fun encryptAsciiArmored(@TestParameter encryptionKey: EncryptionKey) {
|
||||||
val ciphertextStream = ByteArrayOutputStream()
|
val ciphertextStream = ByteArrayOutputStream()
|
||||||
val encryptRes =
|
val encryptRes =
|
||||||
cryptoHandler.encrypt(
|
cryptoHandler.encrypt(
|
||||||
|
|
Loading…
Reference in a new issue