mirror of
https://github.com/google/nomulus.git
synced 2025-05-04 14:07:51 +02:00
Check there are no unwanted entries in the responses
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=193406657
This commit is contained in:
parent
2c0fb6d5a6
commit
0f2a1bfccd
1 changed files with 44 additions and 24 deletions
|
@ -71,11 +71,14 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_updateRegistrarInfo_duplicateContacts() throws Exception {
|
public void testFailure_updateRegistrarInfo_duplicateContacts() throws Exception {
|
||||||
Map<String, Object> response =
|
Map<String, Object> response = action.handleJsonRequest(
|
||||||
action.handleJsonRequest(
|
|
||||||
readJsonFromFile("update_registrar_duplicate_contacts.json", getLastUpdateTime()));
|
readJsonFromFile("update_registrar_duplicate_contacts.json", getLastUpdateTime()));
|
||||||
assertThat(response).containsEntry("status", "ERROR");
|
assertThat(response).containsExactly(
|
||||||
assertThat((String) response.get("message")).startsWith("One email address");
|
"status", "ERROR",
|
||||||
|
"results", ImmutableList.of(),
|
||||||
|
"message",
|
||||||
|
"One email address (etphonehome@example.com) cannot be used for multiple contacts");
|
||||||
|
assertNoTasksEnqueued("sheet");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -93,8 +96,10 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
@Test
|
@Test
|
||||||
public void testRead_authorized_returnsRegistrarJson() throws Exception {
|
public void testRead_authorized_returnsRegistrarJson() throws Exception {
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of());
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of());
|
||||||
assertThat(response).containsEntry("status", "SUCCESS");
|
assertThat(response).containsExactly(
|
||||||
assertThat(response).containsEntry("results", asList(loadRegistrar(CLIENT_ID).toJsonMap()));
|
"status", "SUCCESS",
|
||||||
|
"message", "Success",
|
||||||
|
"results", asList(loadRegistrar(CLIENT_ID).toJsonMap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -102,9 +107,11 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||||
"op", "update",
|
"op", "update",
|
||||||
"args", ImmutableMap.of()));
|
"args", ImmutableMap.of()));
|
||||||
assertThat(response).containsEntry("status", "ERROR");
|
assertThat(response).containsExactly(
|
||||||
assertThat(response).containsEntry("field", "lastUpdateTime");
|
"status", "ERROR",
|
||||||
assertThat(response).containsEntry("message", "This field is required.");
|
"field", "lastUpdateTime",
|
||||||
|
"results", ImmutableList.of(),
|
||||||
|
"message", "This field is required.");
|
||||||
assertNoTasksEnqueued("sheet");
|
assertNoTasksEnqueued("sheet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,9 +120,11 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||||
"op", "update",
|
"op", "update",
|
||||||
"args", ImmutableMap.of("lastUpdateTime", getLastUpdateTime())));
|
"args", ImmutableMap.of("lastUpdateTime", getLastUpdateTime())));
|
||||||
assertThat(response).containsEntry("status", "ERROR");
|
assertThat(response).containsExactly(
|
||||||
assertThat(response).containsEntry("field", "emailAddress");
|
"status", "ERROR",
|
||||||
assertThat(response).containsEntry("message", "This field is required.");
|
"field", "emailAddress",
|
||||||
|
"results", ImmutableList.of(),
|
||||||
|
"message", "This field is required.");
|
||||||
assertNoTasksEnqueued("sheet");
|
assertNoTasksEnqueued("sheet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,17 +135,24 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||||
"op", "update",
|
"op", "update",
|
||||||
"args", ImmutableMap.of("lastUpdateTime", getLastUpdateTime())));
|
"args", ImmutableMap.of("lastUpdateTime", getLastUpdateTime())));
|
||||||
assertThat(response).containsEntry("status", "SUCCESS");
|
assertThat(response).containsExactly(
|
||||||
|
"status", "SUCCESS",
|
||||||
|
"message", "Saved TheRegistrar",
|
||||||
|
"results", asList(loadRegistrar(CLIENT_ID).toJsonMap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdate_badEmail_errorEmailField() throws Exception {
|
public void testUpdate_badEmail_errorEmailField() throws Exception {
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||||
"op", "update",
|
"op", "update",
|
||||||
"args", ImmutableMap.of("lastUpdateTime", getLastUpdateTime(), "emailAddress", "lolcat")));
|
"args", ImmutableMap.of(
|
||||||
assertThat(response).containsEntry("status", "ERROR");
|
"lastUpdateTime", getLastUpdateTime(),
|
||||||
assertThat(response).containsEntry("field", "emailAddress");
|
"emailAddress", "lolcat")));
|
||||||
assertThat(response).containsEntry("message", "Please enter a valid email address.");
|
assertThat(response).containsExactly(
|
||||||
|
"status", "ERROR",
|
||||||
|
"field", "emailAddress",
|
||||||
|
"results", ImmutableList.of(),
|
||||||
|
"message", "Please enter a valid email address.");
|
||||||
assertNoTasksEnqueued("sheet");
|
assertNoTasksEnqueued("sheet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,9 +161,11 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
|
||||||
"op", "update",
|
"op", "update",
|
||||||
"args", ImmutableMap.of("lastUpdateTime", "cookies")));
|
"args", ImmutableMap.of("lastUpdateTime", "cookies")));
|
||||||
assertThat(response).containsEntry("status", "ERROR");
|
assertThat(response).containsExactly(
|
||||||
assertThat(response).containsEntry("field", "lastUpdateTime");
|
"status", "ERROR",
|
||||||
assertThat(response).containsEntry("message", "Not a valid ISO date-time string.");
|
"field", "lastUpdateTime",
|
||||||
|
"results", ImmutableList.of(),
|
||||||
|
"message", "Not a valid ISO date-time string.");
|
||||||
assertNoTasksEnqueued("sheet");
|
assertNoTasksEnqueued("sheet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,9 +176,11 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
||||||
"args", ImmutableMap.of(
|
"args", ImmutableMap.of(
|
||||||
"lastUpdateTime", getLastUpdateTime(),
|
"lastUpdateTime", getLastUpdateTime(),
|
||||||
"emailAddress", "ヘ(◕。◕ヘ)@example.com")));
|
"emailAddress", "ヘ(◕。◕ヘ)@example.com")));
|
||||||
assertThat(response).containsEntry("status", "ERROR");
|
assertThat(response).containsExactly(
|
||||||
assertThat(response).containsEntry("field", "emailAddress");
|
"status", "ERROR",
|
||||||
assertThat(response).containsEntry("message", "Please only use ASCII-US characters.");
|
"field", "emailAddress",
|
||||||
|
"results", ImmutableList.of(),
|
||||||
|
"message", "Please only use ASCII-US characters.");
|
||||||
assertNoTasksEnqueued("sheet");
|
assertNoTasksEnqueued("sheet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue