Add the START_DATE_SUNRISE phase

The START_DATE_SUNRISE phase allows registration of domains only with a signed mark. In all other respects - it is identical to the GENERAL_AVAILABILITY phase.

Note that Anchor Tenants bypass all checks, and are hence able to register domains without a signed mark.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185534793
This commit is contained in:
guyben 2018-02-13 08:38:54 -08:00 committed by jianglai
parent bba975a991
commit b0cbc0f60d
17 changed files with 484 additions and 13 deletions

View file

@ -65,7 +65,9 @@ import google.registry.flows.EppRequestSource;
import google.registry.flows.ExtensionManager.UndeclaredServiceExtensionException;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.domain.DomainCreateFlow.DomainHasOpenApplicationsException;
import google.registry.flows.domain.DomainCreateFlow.MustHaveSignedMarksInCurrentPhaseException;
import google.registry.flows.domain.DomainCreateFlow.NoGeneralRegistrationsInCurrentPhaseException;
import google.registry.flows.domain.DomainFlowTmchUtils.NoMarksFoundMatchingDomainException;
import google.registry.flows.domain.DomainFlowUtils.AcceptedTooLongAgoException;
import google.registry.flows.domain.DomainFlowUtils.BadDomainNameCharacterException;
import google.registry.flows.domain.DomainFlowUtils.BadDomainNamePartsCountException;
@ -1258,6 +1260,15 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_startDateSunrise_missingLaunchExtension() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
persistContactsAndHosts();
EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_quietPeriod() throws Exception {
createTld("tld", TldState.QUIET_PERIOD);
@ -1281,6 +1292,13 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER);
}
@Test
public void testSuccess_superuserStartDateSunrise_isSuperuser() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER);
}
@Test
public void testSuccess_superuserQuietPeriod() throws Exception {
createTld("tld", TldState.QUIET_PERIOD);
@ -1710,6 +1728,68 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
assertClaimsLordn();
}
@Test
public void testFailure_startDateSunriseRegistration_missingSignedMark() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
setEppInput("domain_create_registration_start_date_sunrise.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testSuccess_superuserStartDateSunriseRegistration_isSuperuser() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
setEppInput("domain_create_registration_start_date_sunrise.xml");
persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER);
}
@Test
public void testSuccess_qlpRegistrationSunriseRegistration() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
setEppInput("domain_create_registration_qlp_start_date_sunrise.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertSuccessfulCreate("tld", true);
assertNoLordn();
}
@Test
public void testSuccess_startDateSunriseRegistration_withEncodedSignedMark() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
setEppInput("domain_create_registration_start_date_sunrise_encoded_signed_mark.xml");
persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response_encoded_signed_mark_name.xml"));
assertSuccessfulCreate("tld", false);
assertNoLordn("0000001761376042759136-65535", null);
}
@Test
public void testFail_startDateSunriseRegistration_wrongEncodedSignedMark() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
setEppInput("domain_create_registration_start_date_sunrise_wrong_encoded_signed_mark.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_startDateSunriseRegistration_withClaimsNotice() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
setEppInput("domain_create_registration_start_date_sunrise_claims_notice.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_sunrushRegistration() throws Exception {
createTld("tld", TldState.SUNRUSH);