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:
bbilbo 2017-09-08 12:11:16 -07:00 committed by jianglai
parent c85dc0c089
commit 4b83615513
6 changed files with 166 additions and 5 deletions

View file

@ -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();
}
}