fix unit tests
This commit is contained in:
parent
2124a4598a
commit
9cf0b05202
|
@ -36,6 +36,7 @@ import android.database.Cursor;
|
|||
import android.net.Uri;
|
||||
import android.os.RemoteException;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
|
@ -98,15 +99,13 @@ public class KeyWritableRepository extends KeyRepository {
|
|||
return new KeyWritableRepository(context, localPublicKeyStorage);
|
||||
}
|
||||
|
||||
private KeyWritableRepository(Context context, LocalPublicKeyStorage localPublicKeyStorage) {
|
||||
@VisibleForTesting
|
||||
KeyWritableRepository(Context context, LocalPublicKeyStorage localPublicKeyStorage) {
|
||||
this(context, localPublicKeyStorage, new OperationLog(), 0);
|
||||
}
|
||||
|
||||
private KeyWritableRepository(Context context, LocalPublicKeyStorage localPublicKeyStorage, OperationLog log) {
|
||||
this(context, localPublicKeyStorage, log, 0);
|
||||
}
|
||||
|
||||
private KeyWritableRepository(Context context, LocalPublicKeyStorage localPublicKeyStorage, OperationLog log, int indent) {
|
||||
private KeyWritableRepository(
|
||||
Context context, LocalPublicKeyStorage localPublicKeyStorage, OperationLog log, int indent) {
|
||||
super(context.getContentResolver(), localPublicKeyStorage, log, indent);
|
||||
|
||||
mContext = context;
|
||||
|
|
|
@ -243,7 +243,8 @@ public class InteropTest {
|
|||
final Uri verifyUri = verify != null ?
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(verify.getMasterKeyId()) : null;
|
||||
|
||||
KeyWritableRepository helper = new KeyWritableRepository(RuntimeEnvironment.application) {
|
||||
KeyWritableRepository helper = new KeyWritableRepository(RuntimeEnvironment.application,
|
||||
LocalPublicKeyStorage.getInstance(RuntimeEnvironment.application)) {
|
||||
|
||||
@Override
|
||||
public CachedPublicKeyRing getCachedPublicKeyRing(Uri queryUri) throws PgpKeyNotFoundException {
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) Art O Cathain
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.sufficientlysecure.keychain.support;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeyWritableRepository;
|
||||
|
||||
|
||||
class KeyRepositoryStub extends KeyWritableRepository {
|
||||
public KeyRepositoryStub(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CanonicalizedPublicKeyRing getCanonicalizedPublicKeyRing(Uri id) throws NotFoundException {
|
||||
byte[] data = TestDataUtil.readFully(getClass().getResourceAsStream("/public-key-for-sample.blob"));
|
||||
return new CanonicalizedPublicKeyRing(data, 0);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue