fix AuthenticationOperationTest

This commit is contained in:
Vincent Breitmoser 2018-10-02 16:43:28 +02:00
parent c765bef79d
commit 7e5a153a04

View file

@ -150,6 +150,7 @@ public class AuthenticationOperationTest {
databaseInteractor.saveSecretKeyRing(mStaticRingEcDsa); databaseInteractor.saveSecretKeyRing(mStaticRingEcDsa);
databaseInteractor.saveSecretKeyRing(mStaticRingEdDsa); databaseInteractor.saveSecretKeyRing(mStaticRingEdDsa);
databaseInteractor.saveSecretKeyRing(mStaticRingDsa); databaseInteractor.saveSecretKeyRing(mStaticRingDsa);
databaseInteractor.saveSecretKeyRing(mStaticRingRevoked);
// ok NOW log verbosely! // ok NOW log verbosely!
ShadowLog.stream = System.out; ShadowLog.stream = System.out;
@ -401,17 +402,13 @@ public class AuthenticationOperationTest {
@Test @Test
public void testKeySelection() throws Exception { public void testKeySelection() throws Exception {
long expectedAuthSubKeyId = KeyFormattingUtils.convertKeyIdHexToKeyId("0xcf64ee600f6fec9c");
String expectedAuthSubKeyId = "0xcf64ee600f6fec9c";
KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application); KeyRepository keyRepository = KeyRepository.create(RuntimeEnvironment.application);
long masterKeyId = mStaticRingRevoked.getMasterKeyId(); long masterKeyId = mStaticRingRevoked.getMasterKeyId();
Long authSubKeyId = keyRepository.getSecretAuthenticationId(masterKeyId); long authSubKeyId = keyRepository.getEffectiveAuthenticationKeyId(masterKeyId);
String authSubKeyIdString = KeyFormattingUtils.convertKeyIdToHex(authSubKeyId);
boolean isRightKey = authSubKeyIdString.equals(expectedAuthSubKeyId); Assert.assertEquals(expectedAuthSubKeyId, authSubKeyId);
Assert.assertTrue("selected key must be the same: " + authSubKeyIdString + " != " + expectedAuthSubKeyId, isRightKey);
} }
} }