mirror of
https://github.com/google/nomulus.git
synced 2025-06-04 11:37:25 +02:00
Refactor RdeKeyringModule into FakeKeyringModule
A fake Keyring implementation is needed to test Keyring related tools now, so I've refactored the fake RdeKeyring to support all Keyring API methods and moved it to the common testing package. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=149977968
This commit is contained in:
parent
2353bcd8c5
commit
5779cc988b
15 changed files with 281 additions and 47 deletions
|
@ -24,6 +24,7 @@ import static org.junit.Assume.assumeTrue;
|
|||
import com.google.common.io.CharStreams;
|
||||
import google.registry.keyring.api.Keyring;
|
||||
import google.registry.testing.BouncyCastleProviderRule;
|
||||
import google.registry.testing.FakeKeyringModule;
|
||||
import google.registry.testing.GpgSystemCommandRule;
|
||||
import google.registry.testing.ShardableTestCase;
|
||||
import java.io.File;
|
||||
|
@ -50,9 +51,10 @@ public class GhostrydeGpgIntegrationTest extends ShardableTestCase {
|
|||
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
|
||||
|
||||
@Rule
|
||||
public final GpgSystemCommandRule gpg = new GpgSystemCommandRule(
|
||||
RdeTestData.get("pgp-public-keyring.asc"),
|
||||
RdeTestData.get("pgp-private-keyring-registry.asc"));
|
||||
public final GpgSystemCommandRule gpg =
|
||||
new GpgSystemCommandRule(
|
||||
RdeTestData.get("pgp-public-keyring.asc"),
|
||||
RdeTestData.get("pgp-private-keyring-registry.asc"));
|
||||
|
||||
@DataPoints
|
||||
public static GpgCommand[] commands = new GpgCommand[] {
|
||||
|
@ -84,7 +86,7 @@ public class GhostrydeGpgIntegrationTest extends ShardableTestCase {
|
|||
public void test(GpgCommand cmd, BufferSize bufferSize, Filename filename, Content content)
|
||||
throws Exception {
|
||||
assumeTrue(hasCommand(cmd.get() + " --version"));
|
||||
Keyring keyring = new RdeKeyringModule().get();
|
||||
Keyring keyring = new FakeKeyringModule().get();
|
||||
PGPPublicKey publicKey = keyring.getRdeStagingEncryptionKey();
|
||||
File file = new File(gpg.getCwd(), "love.gpg");
|
||||
byte[] data = content.get().getBytes(UTF_8);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue