Don't delete or "redeem" unlimited use AllocationTokens

We haven't started dealing with timing or discounts yet, but unlimited use tokens should actually be unlimited use

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=243318266
This commit is contained in:
gbrodman 2019-04-12 13:05:06 -07:00 committed by Ben McIlwain
parent 77eb7610e8
commit 74971144d2
5 changed files with 44 additions and 3 deletions

View file

@ -23,6 +23,7 @@ import static google.registry.testing.JUnitBackports.assertThrows;
import com.beust.jcommander.ParameterException;
import com.googlecode.objectify.Key;
import google.registry.model.domain.token.AllocationToken;
import google.registry.model.domain.token.AllocationToken.TokenType;
import google.registry.model.reporting.HistoryEntry;
import java.util.Collection;
import javax.annotation.Nullable;
@ -109,6 +110,18 @@ public class DeleteAllocationTokensCommandTest
.containsExactly(preRed1, preRed2, preDom2, othrRed, othrNot);
}
@Test
public void testSkipUnlimitedUseTokens() throws Exception {
AllocationToken unlimitedUseToken =
persistResource(
new AllocationToken.Builder()
.setToken("prefixasdfg897as")
.setTokenType(TokenType.UNLIMITED_USE)
.build());
runCommandForced("--prefix", "prefix");
assertThat(reloadTokens(unlimitedUseToken)).containsExactly(unlimitedUseToken);
}
@Test
public void test_batching() throws Exception {
for (int i = 0; i < 50; i++) {