mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Ensure that poll messages are created in domain create flow tests
Also ensures that a custom logic hook is called on create. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143112481
This commit is contained in:
parent
1c927a48e9
commit
393eeabc5e
6 changed files with 142 additions and 4 deletions
|
@ -20,6 +20,7 @@ import static google.registry.model.domain.fee.Fee.FEE_EXTENSION_URIS;
|
|||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.pricing.PricingEngineProxy.isDomainPremium;
|
||||
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.assertPollMessagesForResource;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.deleteTld;
|
||||
import static google.registry.testing.DatastoreHelper.getHistoryEntries;
|
||||
|
@ -112,6 +113,7 @@ import google.registry.model.domain.launch.LaunchNotice;
|
|||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.registry.Registry.TldState;
|
||||
|
@ -234,6 +236,15 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
expectedBillingEvents.add(eapBillingEvent);
|
||||
}
|
||||
assertBillingEvents(expectedBillingEvents.build());
|
||||
assertPollMessagesForResource(
|
||||
domain,
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(domain.getFullyQualifiedDomainName())
|
||||
.setClientId("TheRegistrar")
|
||||
.setEventTime(domain.getRegistrationExpirationTime())
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setParent(historyEntry)
|
||||
.build());
|
||||
|
||||
assertGracePeriods(
|
||||
domain.getGracePeriods(),
|
||||
|
@ -1175,6 +1186,36 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
assertSuccessfulCreate("example", false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_customLogicIsCalled_andSavesExtraEntity() throws Exception {
|
||||
// @see TestDomainCreateFlowCustomLogic for what the label "custom-logic-test" triggers.
|
||||
ImmutableMap<String, String> substitutions = ImmutableMap.of("DOMAIN", "custom-logic-test.tld");
|
||||
setEppInput("domain_create_wildcard.xml", substitutions);
|
||||
persistContactsAndHosts();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE,
|
||||
UserPrivileges.NORMAL,
|
||||
readFile("domain_create_response_wildcard.xml", substitutions));
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
HistoryEntry historyEntry = getHistoryEntries(domain).get(0);
|
||||
assertPollMessagesForResource(
|
||||
domain,
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(domain.getFullyQualifiedDomainName())
|
||||
.setClientId("TheRegistrar")
|
||||
.setEventTime(domain.getRegistrationExpirationTime())
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setParent(historyEntry)
|
||||
.build(),
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setParent(historyEntry)
|
||||
.setEventTime(domain.getCreationTime())
|
||||
.setClientId("TheRegistrar")
|
||||
.setMsg("Custom logic was triggered")
|
||||
.setId(1L)
|
||||
.build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_duplicateContact() throws Exception {
|
||||
setEppInput("domain_create_duplicate_contact.xml");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue