mirror of
https://github.com/google/nomulus.git
synced 2025-07-19 17:26:09 +02:00
Add support for a domain delete superuser EPP extension
Allow superusers to change the grace period and allow superusers to change the pending delete length. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=168028545
This commit is contained in:
parent
c85dc0c089
commit
4b83615513
6 changed files with 166 additions and 5 deletions
|
@ -952,4 +952,89 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
// The cancellation record is the same as the original, except with a -1 counter
|
||||
existingRecord.asBuilder().setReportAmount(-1).build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_superuserExtension_nonZeroDayGrace_nonZeroDayPendingDelete()
|
||||
throws Exception {
|
||||
eppRequestSource = EppRequestSource.TOOL;
|
||||
setEppInput(
|
||||
"domain_delete_superuser_extension.xml",
|
||||
ImmutableMap.of("REDEMPTION_GRACE_PERIOD_DAYS", "15", "PENDING_DELETE_DAYS", "4"));
|
||||
setUpSuccessfulTest();
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response_pending.xml"));
|
||||
DomainResource resource = reloadResourceByForeignKey();
|
||||
assertAboutDomains()
|
||||
.that(resource)
|
||||
.hasExactlyStatusValues(StatusValue.INACTIVE, StatusValue.PENDING_DELETE)
|
||||
.and()
|
||||
.hasDeletionTime(clock.nowUtc().plus(Duration.standardDays(19)));
|
||||
assertThat(resource.getGracePeriods())
|
||||
.containsExactly(
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.REDEMPTION,
|
||||
clock.nowUtc().plus(Duration.standardDays(15)),
|
||||
"TheRegistrar",
|
||||
null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_superuserExtension_zeroDayGrace_nonZeroDayPendingDelete()
|
||||
throws Exception {
|
||||
eppRequestSource = EppRequestSource.TOOL;
|
||||
setEppInput(
|
||||
"domain_delete_superuser_extension.xml",
|
||||
ImmutableMap.of("REDEMPTION_GRACE_PERIOD_DAYS", "0", "PENDING_DELETE_DAYS", "4"));
|
||||
setUpSuccessfulTest();
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response_pending.xml"));
|
||||
DomainResource resource = reloadResourceByForeignKey();
|
||||
assertAboutDomains()
|
||||
.that(resource)
|
||||
.hasExactlyStatusValues(StatusValue.INACTIVE, StatusValue.PENDING_DELETE)
|
||||
.and()
|
||||
.hasDeletionTime(clock.nowUtc().plus(Duration.standardDays(4)));
|
||||
assertThat(resource.getGracePeriods()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_superuserExtension_nonZeroDayGrace_zeroDayPendingDelete()
|
||||
throws Exception {
|
||||
eppRequestSource = EppRequestSource.TOOL;
|
||||
setEppInput(
|
||||
"domain_delete_superuser_extension.xml",
|
||||
ImmutableMap.of("REDEMPTION_GRACE_PERIOD_DAYS", "15", "PENDING_DELETE_DAYS", "0"));
|
||||
setUpSuccessfulTest();
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response_pending.xml"));
|
||||
DomainResource resource = reloadResourceByForeignKey();
|
||||
assertAboutDomains()
|
||||
.that(resource)
|
||||
.hasExactlyStatusValues(StatusValue.INACTIVE, StatusValue.PENDING_DELETE)
|
||||
.and()
|
||||
.hasDeletionTime(clock.nowUtc().plus(Duration.standardDays(15)));
|
||||
assertThat(resource.getGracePeriods())
|
||||
.containsExactly(
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.REDEMPTION,
|
||||
clock.nowUtc().plus(Duration.standardDays(15)),
|
||||
"TheRegistrar",
|
||||
null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_superuserExtension_zeroDayGrace_zeroDayPendingDelete() throws Exception {
|
||||
eppRequestSource = EppRequestSource.TOOL;
|
||||
setEppInput(
|
||||
"domain_delete_superuser_extension.xml",
|
||||
ImmutableMap.of("REDEMPTION_GRACE_PERIOD_DAYS", "0", "PENDING_DELETE_DAYS", "0"));
|
||||
setUpSuccessfulTest();
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_delete_response.xml"));
|
||||
assertThat(reloadResourceByForeignKey()).isNull();
|
||||
}
|
||||
}
|
||||
|
|
17
javatests/google/registry/flows/domain/testdata/domain_delete_superuser_extension.xml
vendored
Normal file
17
javatests/google/registry/flows/domain/testdata/domain_delete_superuser_extension.xml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<delete>
|
||||
<domain:delete
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.tld</domain:name>
|
||||
</domain:delete>
|
||||
</delete>
|
||||
<extension>
|
||||
<superuser:domainDelete xmlns:superuser="urn:google:params:xml:ns:superuser-1.0">
|
||||
<superuser:redemptionGracePeriodDays>%REDEMPTION_GRACE_PERIOD_DAYS%</superuser:redemptionGracePeriodDays>
|
||||
<superuser:pendingDeleteDays>%PENDING_DELETE_DAYS%</superuser:pendingDeleteDays>
|
||||
</superuser:domainDelete>
|
||||
</extension>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue