mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 16:37:13 +02:00
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:
parent
3b87d4de64
commit
63807aa9be
11 changed files with 356 additions and 31 deletions
|
@ -15,6 +15,7 @@
|
|||
package google.registry.flows.domain.token;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.domain.token.AllocationToken.TokenType.SINGLE_USE;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
|
@ -57,7 +58,8 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase {
|
|||
@Test
|
||||
public void test_verifyToken_successfullyVerifiesValidToken() throws Exception {
|
||||
AllocationToken token =
|
||||
persistResource(new AllocationToken.Builder().setToken("tokeN").build());
|
||||
persistResource(
|
||||
new AllocationToken.Builder().setToken("tokeN").setTokenType(SINGLE_USE).build());
|
||||
AllocationTokenFlowUtils flowUtils =
|
||||
new AllocationTokenFlowUtils(new AllocationTokenCustomLogic());
|
||||
assertThat(
|
||||
|
@ -89,7 +91,8 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void test_verifyToken_callsCustomLogic() {
|
||||
persistResource(new AllocationToken.Builder().setToken("tokeN").build());
|
||||
persistResource(
|
||||
new AllocationToken.Builder().setToken("tokeN").setTokenType(SINGLE_USE).build());
|
||||
AllocationTokenFlowUtils flowUtils =
|
||||
new AllocationTokenFlowUtils(new FailingAllocationTokenCustomLogic());
|
||||
Exception thrown =
|
||||
|
@ -107,7 +110,8 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void test_checkDomainsWithToken_successfullyVerifiesValidToken() {
|
||||
persistResource(new AllocationToken.Builder().setToken("tokeN").build());
|
||||
persistResource(
|
||||
new AllocationToken.Builder().setToken("tokeN").setTokenType(SINGLE_USE).build());
|
||||
AllocationTokenFlowUtils flowUtils =
|
||||
new AllocationTokenFlowUtils(new AllocationTokenCustomLogic());
|
||||
assertThat(
|
||||
|
@ -128,6 +132,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase {
|
|||
persistResource(
|
||||
new AllocationToken.Builder()
|
||||
.setToken("tokeN")
|
||||
.setTokenType(SINGLE_USE)
|
||||
.setRedemptionHistoryEntry(Key.create(HistoryEntry.class, 101L))
|
||||
.build());
|
||||
AllocationTokenFlowUtils flowUtils =
|
||||
|
@ -150,7 +155,8 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void test_checkDomainsWithToken_callsCustomLogic() {
|
||||
persistResource(new AllocationToken.Builder().setToken("tokeN").build());
|
||||
persistResource(
|
||||
new AllocationToken.Builder().setToken("tokeN").setTokenType(SINGLE_USE).build());
|
||||
AllocationTokenFlowUtils flowUtils =
|
||||
new AllocationTokenFlowUtils(new FailingAllocationTokenCustomLogic());
|
||||
Exception thrown =
|
||||
|
@ -168,7 +174,8 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void test_checkDomainsWithToken_resultsFromCustomLogicAreIntegrated() {
|
||||
persistResource(new AllocationToken.Builder().setToken("tokeN").build());
|
||||
persistResource(
|
||||
new AllocationToken.Builder().setToken("tokeN").setTokenType(SINGLE_USE).build());
|
||||
AllocationTokenFlowUtils flowUtils =
|
||||
new AllocationTokenFlowUtils(new CustomResultAllocationTokenCustomLogic());
|
||||
assertThat(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue