Allow reserved domains to be created during quiet periods

We'll use this for LRP. This is safe because we must specifically reserve a
domain by including it in a reserved list, create an associated allocation
token, and distribute that token, before a create would succeed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=250901144
This commit is contained in:
mcilwain 2019-05-31 09:38:18 -07:00 committed by Ben McIlwain
parent 79bcb227be
commit ff6d327183
2 changed files with 39 additions and 3 deletions

View file

@ -1149,6 +1149,30 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
assertAllocationTokenWasRedeemed("abc123");
}
@Test
public void testSuccess_reservedDomain_viaAllocationTokenExtension_inQuietPeriod()
throws Exception {
persistResource(
Registry.get("tld")
.asBuilder()
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
.build());
allocationToken =
persistResource(
new AllocationToken.Builder()
.setToken("abc123")
.setTokenType(SINGLE_USE)
.setDomainName("resdom.tld")
.build());
setEppInput("domain_create_allocationtoken.xml", ImmutableMap.of("DOMAIN", "resdom.tld"));
persistContactsAndHosts();
runFlowAssertResponse(
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "resdom.tld")));
assertSuccessfulCreate("tld", ImmutableSet.of(RESERVED), allocationToken);
assertNoLordn();
assertAllocationTokenWasRedeemed("abc123");
}
private void assertAllocationTokenWasRedeemed(String token) throws Exception {
AllocationToken reloadedToken =
ofy().load().key(Key.create(AllocationToken.class, token)).now();