mirror of
https://github.com/google/nomulus.git
synced 2025-07-21 10:16:07 +02:00
Add domain lifecycle test for renew with total term >10 years
Also some minor cleanup to make renewal testdata files easier to reuse. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187508329
This commit is contained in:
parent
27894df45f
commit
ef26dabf32
6 changed files with 79 additions and 24 deletions
|
@ -817,6 +817,21 @@ public class EppLifecycleDomainTest extends EppTestCase {
|
|||
assertCommandAndResponse("logout.xml", "logout_response.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRenewalFails_whenTotalTermExceeds10Years() throws Exception {
|
||||
assertCommandAndResponse("login_valid.xml", "login_response.xml");
|
||||
// Creates domain with 2 year expiration.
|
||||
createFakesite();
|
||||
// Attempt to renew for 9 years, adding up to a total greater than the allowed max of 10 years.
|
||||
assertCommandAndResponse(
|
||||
"domain_renew.xml",
|
||||
ImmutableMap.of("DOMAIN", "fakesite.example", "EXPDATE", "2002-06-01", "YEARS", "9"),
|
||||
"domain_renew_response_exceeds_max_years.xml",
|
||||
ImmutableMap.of(),
|
||||
DateTime.parse("2000-06-07T00:00:00Z"));
|
||||
assertCommandAndResponse("logout.xml", "logout_response.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDomainDeletionCancelsPendingTransfer() throws Exception {
|
||||
// Register the domain as the first registrar.
|
||||
|
|
|
@ -83,14 +83,11 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
|
||||
final DateTime expirationTime = DateTime.parse("2000-04-03T22:00:00.0Z");
|
||||
|
||||
public DomainRenewFlowTest() {
|
||||
clock.setTo(expirationTime.minusMillis(2));
|
||||
setEppInput("domain_renew.xml");
|
||||
}
|
||||
|
||||
@Before
|
||||
public void initDomainTest() {
|
||||
createTld("tld");
|
||||
clock.setTo(expirationTime.minusMillis(2));
|
||||
setEppInput("domain_renew.xml", ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "5"));
|
||||
}
|
||||
|
||||
private void persistDomain(StatusValue... statusValues) throws Exception {
|
||||
|
@ -122,7 +119,6 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setMsg("Domain was auto-renewed.")
|
||||
.setParent(historyEntryDomainCreate)
|
||||
.build());
|
||||
domain =
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
|
@ -228,13 +224,19 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
@Test
|
||||
public void testDryRun() throws Exception {
|
||||
persistDomain();
|
||||
dryRunFlowAssertResponse(loadFile("domain_renew_response.xml"));
|
||||
dryRunFlowAssertResponse(
|
||||
loadFile(
|
||||
"domain_renew_response.xml",
|
||||
ImmutableMap.of("DOMAIN", "example.tld", "EXDATE", "2005-04-03T22:00:00.0Z")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess() throws Exception {
|
||||
persistDomain();
|
||||
doSuccessfulTest("domain_renew_response.xml", 5);
|
||||
doSuccessfulTest(
|
||||
"domain_renew_response.xml",
|
||||
5,
|
||||
ImmutableMap.of("DOMAIN", "example.tld", "EXDATE", "2005-04-03T22:00:00.0Z"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -380,7 +382,10 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setRenewGracePeriodLength(Duration.standardMinutes(9))
|
||||
.build());
|
||||
persistDomain();
|
||||
doSuccessfulTest("domain_renew_response.xml", 5);
|
||||
doSuccessfulTest(
|
||||
"domain_renew_response.xml",
|
||||
5,
|
||||
ImmutableMap.of("DOMAIN", "example.tld", "EXDATE", "2005-04-03T22:00:00.0Z"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -402,7 +407,10 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.asBuilder()
|
||||
.setEventTime(expirationTime.minusYears(1))
|
||||
.build());
|
||||
runFlowAssertResponse(loadFile("domain_renew_response.xml"));
|
||||
runFlowAssertResponse(
|
||||
loadFile(
|
||||
"domain_renew_response.xml",
|
||||
ImmutableMap.of("DOMAIN", "example.tld", "EXDATE", "2005-04-03T22:00:00.0Z")));
|
||||
HistoryEntry historyEntryDomainRenew =
|
||||
getOnlyHistoryEntryOfType(reloadResourceByForeignKey(), HistoryEntry.Type.DOMAIN_RENEW);
|
||||
assertPollMessages(
|
||||
|
@ -644,7 +652,11 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
sessionMetadata.setClientId("NewRegistrar");
|
||||
persistDomain();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_renew_response.xml"));
|
||||
CommitMode.LIVE,
|
||||
UserPrivileges.SUPERUSER,
|
||||
loadFile(
|
||||
"domain_renew_response.xml",
|
||||
ImmutableMap.of("DOMAIN", "example.tld", "EXDATE", "2005-04-03T22:00:00.0Z")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -662,7 +674,11 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||
persistDomain();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_renew_response.xml"));
|
||||
CommitMode.LIVE,
|
||||
UserPrivileges.SUPERUSER,
|
||||
loadFile(
|
||||
"domain_renew_response.xml",
|
||||
ImmutableMap.of("DOMAIN", "example.tld", "EXDATE", "2005-04-03T22:00:00.0Z")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<renew>
|
||||
<domain:renew
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.tld</domain:name>
|
||||
<domain:name>%DOMAIN%</domain:name>
|
||||
<domain:curExpDate>2000-04-03</domain:curExpDate>
|
||||
<domain:period unit="y">5</domain:period>
|
||||
<domain:period unit="y">%YEARS%</domain:period>
|
||||
</domain:renew>
|
||||
</renew>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<resData>
|
||||
<domain:renData
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.tld</domain:name>
|
||||
<domain:exDate>2005-04-03T22:00:00.0Z</domain:exDate>
|
||||
<domain:name>%DOMAIN%</domain:name>
|
||||
<domain:exDate>%EXDATE%</domain:exDate>
|
||||
</domain:renData>
|
||||
</resData>
|
||||
<trID>
|
||||
|
|
13
javatests/google/registry/flows/testdata/domain_renew.xml
vendored
Normal file
13
javatests/google/registry/flows/testdata/domain_renew.xml
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<renew>
|
||||
<domain:renew
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>%DOMAIN%</domain:name>
|
||||
<domain:curExpDate>%EXPDATE%</domain:curExpDate>
|
||||
<domain:period unit="y">%YEARS%</domain:period>
|
||||
</domain:renew>
|
||||
</renew>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
11
javatests/google/registry/flows/testdata/domain_renew_response_exceeds_max_years.xml
vendored
Normal file
11
javatests/google/registry/flows/testdata/domain_renew_response_exceeds_max_years.xml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<response>
|
||||
<result code="2004">
|
||||
<msg>New registration period exceeds maximum number of years (10)</msg>
|
||||
</result>
|
||||
<trID>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
<svTRID>server-trid</svTRID>
|
||||
</trID>
|
||||
</response>
|
||||
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue