mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Decentralize how registry phase checks are done in flows
Very few flows actually check the phase. Push the checks down to the leaf flows so that we can remove the inherited code from ResourceFlow and replace it with utility methods. In the process, document and test two places that throw the exception but did not previously test it. This introduces a temporary hack in BaseDomainCreateFlow that does something specific for DomainApplicationCreateFlow. It will go away literally tomorrow when I flatten that flow. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=135480538
This commit is contained in:
parent
aaa84d6ec6
commit
a09d48a4a5
18 changed files with 166 additions and 129 deletions
|
@ -33,9 +33,9 @@ import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
|||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
import google.registry.flows.domain.DomainApplicationDeleteFlow.SunriseApplicationCannotBeDeletedInLandrushException;
|
||||
import google.registry.flows.domain.DomainFlowUtils.ApplicationDomainNameMismatchException;
|
||||
import google.registry.flows.domain.DomainFlowUtils.BadCommandForRegistryPhaseException;
|
||||
import google.registry.flows.domain.DomainFlowUtils.LaunchPhaseMismatchException;
|
||||
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
||||
import google.registry.flows.exceptions.BadCommandForRegistryPhaseException;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
|
@ -264,6 +264,36 @@ public class DomainApplicationDeleteFlowTest
|
|||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_superuserQuietPeriod() throws Exception {
|
||||
createTld("tld", TldState.QUIET_PERIOD);
|
||||
persistResource(
|
||||
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_superuserPredelegation() throws Exception {
|
||||
createTld("tld", TldState.PREDELEGATION);
|
||||
persistResource(
|
||||
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_superuserGeneralAvailability() throws Exception {
|
||||
createTld("tld", TldState.GENERAL_AVAILABILITY);
|
||||
persistResource(
|
||||
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_applicationIdForDifferentDomain() throws Exception {
|
||||
thrown.expect(ApplicationDomainNameMismatchException.class);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue