mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 16:37:13 +02:00
Re-add EppException marshalling assertions in domain flow tests
Apologies for the reformatting, but this refactoring is quite rote and it's definitely a bigger use of total time to perform the reformatting individually than to simply do it file-wide. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179238852
This commit is contained in:
parent
34699465d5
commit
d538dca2e0
7 changed files with 1296 additions and 869 deletions
|
@ -18,10 +18,12 @@ import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.domain.DomainClaimsCheckFlow.DomainClaimsCheckNotAllowedInSunrise;
|
||||
import google.registry.flows.domain.DomainFlowUtils.BadCommandForRegistryPhaseException;
|
||||
|
@ -51,8 +53,8 @@ public class DomainClaimsCheckFlowTest
|
|||
|
||||
protected void doSuccessfulTest(String expectedXmlFilename) throws Exception {
|
||||
assertTransactionalFlow(false);
|
||||
assertNoHistory(); // Checks don't create a history event.
|
||||
assertNoBillingEvents(); // Checks are always free.
|
||||
assertNoHistory(); // Checks don't create a history event.
|
||||
assertNoBillingEvents(); // Checks are always free.
|
||||
runFlowAssertResponse(loadFile(expectedXmlFilename));
|
||||
}
|
||||
|
||||
|
@ -102,20 +104,23 @@ public class DomainClaimsCheckFlowTest
|
|||
@Test
|
||||
public void testFailure_TooManyIds() throws Exception {
|
||||
setEppInput("domain_check_claims_51.xml");
|
||||
assertThrows(TooManyResourceChecksException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_tldDoesntExist() throws Exception {
|
||||
setEppInput("domain_check_claims_bad_tld.xml");
|
||||
assertThrows(TldDoesNotExistException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_notAuthorizedForTld() throws Exception {
|
||||
persistResource(
|
||||
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||
assertThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -136,7 +141,8 @@ public class DomainClaimsCheckFlowTest
|
|||
createTld("tld", TldState.PREDELEGATION);
|
||||
persistResource(Registry.get("tld").asBuilder().build());
|
||||
setEppInput("domain_check_claims.xml");
|
||||
assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -144,7 +150,8 @@ public class DomainClaimsCheckFlowTest
|
|||
createTld("tld", TldState.SUNRISE);
|
||||
persistResource(Registry.get("tld").asBuilder().build());
|
||||
setEppInput("domain_check_claims.xml");
|
||||
assertThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow);
|
||||
EppException thrown = expectThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -154,7 +161,8 @@ public class DomainClaimsCheckFlowTest
|
|||
persistResource(
|
||||
Registry.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build());
|
||||
setEppInput("domain_check_claims_multiple_tlds.xml");
|
||||
assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ClaimsPeriodEndedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue