Add necessary fields to the AllocationToken schema

See https://docs.google.com/document/d/1SSWrILRpx0Mtr4sdvlYwz9I8wJp5Gu_o4qlml3iJDKI

This is just the base for now--we don't actually do anything with it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=243265164
This commit is contained in:
gbrodman 2019-04-12 08:05:56 -07:00 committed by Ben McIlwain
parent 314daff8a1
commit cfee7e7fd5
11 changed files with 356 additions and 31 deletions

View file

@ -15,6 +15,7 @@
package google.registry.tools;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.domain.token.AllocationToken.TokenType.SINGLE_USE;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.assertThrows;
@ -129,7 +130,10 @@ public class DeleteAllocationTokensCommandTest
private static AllocationToken persistToken(
String token, @Nullable String domainName, boolean redeemed) {
AllocationToken.Builder builder =
new AllocationToken.Builder().setToken(token).setDomainName(domainName);
new AllocationToken.Builder()
.setToken(token)
.setTokenType(SINGLE_USE)
.setDomainName(domainName);
if (redeemed) {
builder.setRedemptionHistoryEntry(Key.create(HistoryEntry.class, 1051L));
}