From 7e5a153a041ff998f9e69d960d5b03fddb4390a7 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Tue, 2 Oct 2018 16:43:28 +0200 Subject: [PATCH] fix AuthenticationOperationTest --- .../operations/AuthenticationOperationTest.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/AuthenticationOperationTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/AuthenticationOperationTest.java index 80d277ca1..e22585d7c 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/AuthenticationOperationTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/AuthenticationOperationTest.java @@ -150,6 +150,7 @@ public class AuthenticationOperationTest { databaseInteractor.saveSecretKeyRing(mStaticRingEcDsa); databaseInteractor.saveSecretKeyRing(mStaticRingEdDsa); databaseInteractor.saveSecretKeyRing(mStaticRingDsa); + databaseInteractor.saveSecretKeyRing(mStaticRingRevoked); // ok NOW log verbosely! ShadowLog.stream = System.out; @@ -401,17 +402,13 @@ public class AuthenticationOperationTest { @Test public void testKeySelection() throws Exception { - - String expectedAuthSubKeyId = "0xcf64ee600f6fec9c"; + long expectedAuthSubKeyId = KeyFormattingUtils.convertKeyIdHexToKeyId("0xcf64ee600f6fec9c"); KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application); long masterKeyId = mStaticRingRevoked.getMasterKeyId(); - Long authSubKeyId = keyRepository.getSecretAuthenticationId(masterKeyId); - String authSubKeyIdString = KeyFormattingUtils.convertKeyIdToHex(authSubKeyId); + long authSubKeyId = keyRepository.getEffectiveAuthenticationKeyId(masterKeyId); - boolean isRightKey = authSubKeyIdString.equals(expectedAuthSubKeyId); - - Assert.assertTrue("selected key must be the same: " + authSubKeyIdString + " != " + expectedAuthSubKeyId, isRightKey); + Assert.assertEquals(expectedAuthSubKeyId, authSubKeyId); } }