mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +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
|
@ -22,7 +22,6 @@ import com.google.common.truth.SimpleSubjectBuilder;
|
|||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.contact.PostalInfo;
|
||||
import google.registry.model.eppcommon.AuthInfo;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.testing.TruthChainer.And;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
|
@ -126,42 +125,6 @@ public final class ContactResourceSubject
|
|||
return hasValue(pw, authInfo == null ? null : authInfo.getPw().getValue(), "has auth info pw");
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasTransferStatus(TransferStatus transferStatus) {
|
||||
return hasValue(
|
||||
transferStatus,
|
||||
actual().getTransferData().getTransferStatus(),
|
||||
"has transferStatus");
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasTransferRequestClientTrid(String clTrid) {
|
||||
return hasValue(
|
||||
clTrid,
|
||||
actual().getTransferData().getTransferRequestTrid().getClientTransactionId(),
|
||||
"has trid");
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasPendingTransferExpirationTime(
|
||||
DateTime pendingTransferExpirationTime) {
|
||||
return hasValue(
|
||||
pendingTransferExpirationTime,
|
||||
actual().getTransferData().getPendingTransferExpirationTime(),
|
||||
"has pendingTransferExpirationTime");
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasTransferGainingClientId(String gainingClientId) {
|
||||
return hasValue(
|
||||
gainingClientId,
|
||||
actual().getTransferData().getGainingClientId(),
|
||||
"has transfer ga");
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasTransferLosingClientId(String losingClientId) {
|
||||
return hasValue(
|
||||
losingClientId,
|
||||
actual().getTransferData().getLosingClientId(),
|
||||
"has transfer losingClientId");
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasLastTransferTime(DateTime lastTransferTime) {
|
||||
return hasValue(
|
||||
lastTransferTime,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue