mirror of
https://github.com/google/nomulus
synced 2026-09-05 15:46:55 +00: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:
@@ -657,6 +657,22 @@ public class DatastoreHelper {
|
||||
return billingEvent.asBuilder().setId(1L).build();
|
||||
}};
|
||||
|
||||
public static void assertPollMessagesForResource(EppResource resource, PollMessage... expected)
|
||||
throws Exception {
|
||||
assertThat(FluentIterable.from(getPollMessages(resource)).transform(POLL_MESSAGE_ID_STRIPPER))
|
||||
.containsExactlyElementsIn(
|
||||
FluentIterable.from(asList(expected)).transform(POLL_MESSAGE_ID_STRIPPER));
|
||||
}
|
||||
|
||||
/** Helper to effectively erase the poll message ID to facilitate comparison. */
|
||||
public static final Function<PollMessage, PollMessage> POLL_MESSAGE_ID_STRIPPER =
|
||||
new Function<PollMessage, PollMessage>() {
|
||||
@Override
|
||||
public PollMessage apply(PollMessage pollMessage) {
|
||||
// Can't use id=0 because that causes the builder to generate a new id.
|
||||
return pollMessage.asBuilder().setId(1L).build();
|
||||
}};
|
||||
|
||||
public static ImmutableList<PollMessage> getPollMessages() {
|
||||
return FluentIterable.from(ofy().load().type(PollMessage.class)).toList();
|
||||
}
|
||||
@@ -667,6 +683,10 @@ public class DatastoreHelper {
|
||||
.toList();
|
||||
}
|
||||
|
||||
public static ImmutableList<PollMessage> getPollMessages(EppResource resource) {
|
||||
return FluentIterable.from(ofy().load().type(PollMessage.class).ancestor(resource)).toList();
|
||||
}
|
||||
|
||||
public static ImmutableList<PollMessage> getPollMessages(String clientId, DateTime now) {
|
||||
return FluentIterable
|
||||
.from(ofy()
|
||||
|
||||
Reference in New Issue
Block a user