mirror of
https://github.com/google/nomulus
synced 2026-09-20 06:54:43 +00: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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user