mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Change transfer flow tests to assert on entire TransferData contents
This CL changes the domain and contact transfer flows to check the entire TransferData on the post-transfer resource, rather than just spot-checking certain fields. This approach provides much better code coverage - in particular, it checks that the non-request flows (approve, cancel, reject) don't modify the fields that they shouldn't be modifying, and that they do actually clear out the transfer server-approve entities fields written by the transfer request flow. It's slightly orthogonal, but I also added testing that the server-approve entities fields are actually set in the request flows, which was previously untested. This is pre-work for introducing an exDate-storing field into TransferData, by making it easier to test everywhere that exDate is set *and* unset only in the correct places. As part of this CL, I've introduced a TransferData.copyConstantFieldsToBuilder() method that is like asBuilder() but instead of copying all the fields to the new builder, it only copies the logically constant ones: losing/gaining client IDs, the request time and TRID, and transferPeriod. This is useful both in tests but is also used in the resolvingPendingTransfer() helper that centralizes the core transfer resolution logic (as of [] That method has its own tests, and in the process I removed a bunch of crufty defunct TransferData tests. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171053454
This commit is contained in:
parent
3584bbde53
commit
7e68ffa16a
17 changed files with 363 additions and 297 deletions
|
@ -35,6 +35,7 @@ import google.registry.model.eppcommon.Trid;
|
|||
import google.registry.model.poll.PendingActionNotificationResponse;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.transfer.TransferData;
|
||||
import google.registry.model.transfer.TransferResponse;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import org.junit.Before;
|
||||
|
@ -62,6 +63,8 @@ public class ContactTransferRejectFlowTest
|
|||
.hasSize(1);
|
||||
|
||||
// Setup done; run the test.
|
||||
contact = reloadResourceByForeignKey();
|
||||
TransferData originalTransferData = contact.getTransferData();
|
||||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(readFile(expectedXmlFilename));
|
||||
|
||||
|
@ -70,10 +73,15 @@ public class ContactTransferRejectFlowTest
|
|||
assertAboutContacts().that(contact)
|
||||
.hasCurrentSponsorClientId("TheRegistrar").and()
|
||||
.hasLastTransferTimeNotEqualTo(clock.nowUtc()).and()
|
||||
.hasTransferStatus(TransferStatus.CLIENT_REJECTED).and()
|
||||
.hasOneHistoryEntryEachOfTypes(
|
||||
HistoryEntry.Type.CONTACT_TRANSFER_REQUEST,
|
||||
HistoryEntry.Type.CONTACT_TRANSFER_REJECT);
|
||||
assertThat(contact.getTransferData())
|
||||
.isEqualTo(
|
||||
originalTransferData.copyConstantFieldsToBuilder()
|
||||
.setTransferStatus(TransferStatus.CLIENT_REJECTED)
|
||||
.setPendingTransferExpirationTime(clock.nowUtc())
|
||||
.build());
|
||||
// The poll message (in the future) to the losing registrar for implicit ack should be gone.
|
||||
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1)))
|
||||
.isEmpty();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue