Add extra flow logic hook for application create

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137396935
This commit is contained in:
mountford 2016-10-27 08:18:39 -07:00 committed by Ben McIlwain
parent bc0116f3a0
commit 60cb1b4dfb
5 changed files with 113 additions and 0 deletions

View file

@ -105,6 +105,8 @@ import google.registry.flows.exceptions.ResourceAlreadyExistsException;
import google.registry.model.domain.DomainApplication;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.LrpTokenEntity;
import google.registry.model.domain.TestExtraLogicManager;
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
import google.registry.model.domain.launch.ApplicationStatus;
import google.registry.model.domain.launch.LaunchNotice;
import google.registry.model.domain.launch.LaunchPhase;
@ -155,6 +157,10 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_encoded_signed_mark.xml");
createTld("tld", TldState.SUNRISE);
persistResource(Registry.get("tld").asBuilder().setReservedLists(createReservedList()).build());
createTld("flags", TldState.LANDRUSH);
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
persistResource(
Registry.get("flags").asBuilder().setReservedLists(createReservedList()).build());
inject.setStaticField(TmchCertificateAuthority.class, "clock", clock);
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
}
@ -1686,4 +1692,20 @@ public class DomainApplicationCreateFlowTest
// .tld
doFailingDomainNameTest("xn--k3hel9n7bxlu1e.tld", InvalidIdnDomainLabelException.class);
}
@Test
public void testFailure_flags_feeMismatch() throws Exception {
persistContactsAndHosts();
setEppInput("domain_create_landrush_flags.xml", ImmutableMap.of("FEE", "12"));
thrown.expect(FeesMismatchException.class);
runFlow();
}
@Test
public void testSuccess_flags() throws Exception {
persistContactsAndHosts();
setEppInput("domain_create_landrush_flags.xml", ImmutableMap.of("FEE", "42"));
thrown.expect(TestExtraLogicManagerSuccessException.class, "flag1,flag2");
runFlow();
}
}