Use StatusValue XML names in EPP error messages

This changes ResourceStatusProhibitsOperationException so that we print out the list of StatusValues using their XML names rather than the literal enum name, i.e. we use "pendingDelete" rather than "PENDING_DELETE".

This seems more correct given that EPP clients will be used to seeing the status values in the XML representation, and it also matches the existing ResourceHasClientUpdateProhibitedException that hardcodes "clientUpdateProhibited":
http://[]/third_party/java_src/gtld/java/google/registry/flows/exceptions/ResourceHasClientUpdateProhibitedException.java?l=22&rcl=146111211

Also reorganized related test methods and added some missing tests, including for ContactTransferRequestFlow which previously had none.  I also renamed the "clientProhibitedStatusValue" tests to instead say "statusValueNotClientSettable" to be clearer about what's being tested, and that it's not related to the "clientXXProhibited" statuses.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150248562
This commit is contained in:
nickfelt 2017-03-15 15:11:30 -07:00 committed by Ben McIlwain
parent e60c01c2f7
commit 6a8b25360c
13 changed files with 197 additions and 120 deletions

View file

@ -832,30 +832,6 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
runFlow();
}
@Test
public void testFailure_clientUpdateProhibited() throws Exception {
createTld("com");
setEppInput("domain_update_authinfo.xml");
persistReferencedEntities();
persistResource(
newDomainResource(getUniqueIdFromCommand()).asBuilder()
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
.build());
thrown.expect(ResourceHasClientUpdateProhibitedException.class);
runFlow();
}
@Test
public void testFailure_serverUpdateProhibited() throws Exception {
persistReferencedEntities();
persistResource(
newDomainResource(getUniqueIdFromCommand()).asBuilder()
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED))
.build());
thrown.expect(ResourceStatusProhibitsOperationException.class);
runFlow();
}
@Test
public void testFailure_missingHost() throws Exception {
persistActiveHost("ns1.example.foo");
@ -898,7 +874,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
}
@Test
public void testFailure_clientProhibitedStatusValue() throws Exception {
public void testFailure_statusValueNotClientSettable() throws Exception {
setEppInput("domain_update_prohibited_status.xml");
persistReferencedEntities();
persistDomain();
@ -907,7 +883,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
}
@Test
public void testSuccess_superuserClientProhibitedStatusValue() throws Exception {
public void testSuccess_superuserStatusValueNotClientSettable() throws Exception {
setEppInput("domain_update_prohibited_status.xml");
persistReferencedEntities();
persistDomain();
@ -917,6 +893,30 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
readFile("domain_update_response.xml"));
}
@Test
public void testFailure_clientUpdateProhibited() throws Exception {
createTld("com");
setEppInput("domain_update_authinfo.xml");
persistReferencedEntities();
persistResource(
newDomainResource(getUniqueIdFromCommand()).asBuilder()
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
.build());
thrown.expect(ResourceHasClientUpdateProhibitedException.class);
runFlow();
}
@Test
public void testFailure_serverUpdateProhibited() throws Exception {
persistReferencedEntities();
persistResource(
newDomainResource(getUniqueIdFromCommand()).asBuilder()
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED))
.build());
thrown.expect(ResourceStatusProhibitsOperationException.class, "serverUpdateProhibited");
runFlow();
}
@Test
public void testFailure_pendingDelete() throws Exception {
persistReferencedEntities();
@ -925,7 +925,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setDeletionTime(clock.nowUtc().plusDays(1))
.addStatusValue(StatusValue.PENDING_DELETE)
.build());
thrown.expect(ResourceStatusProhibitsOperationException.class);
thrown.expect(ResourceStatusProhibitsOperationException.class, "pendingDelete");
runFlow();
}