Improve error when creating domain label lists for non-existent TLDs (#1112)

* Improve error message when creating domain label lists for non-existent TLDs
This commit is contained in:
Ben McIlwain
2021-04-27 19:17:23 -04:00
committed by GitHub
parent 2528ee05dd
commit 9d4de806f5
6 changed files with 44 additions and 10 deletions
@@ -113,7 +113,9 @@ class CreateReservedListCommandTest
@Test
void testNamingRules_tldThatDoesNotExist_failsWithoutOverride() {
runNameTestExpectedFailure("footld_reserved-list", "TLD footld does not exist");
runNameTestExpectedFailure(
"footld_reserved-list",
"The name must be in the format {tld|common}_list-name, yet TLD footld does not exist");
}
@Test
@@ -153,7 +155,9 @@ class CreateReservedListCommandTest
@Test
void testNamingRules_commonAsListName_failsWithoutOverride() {
runNameTestExpectedFailure("invalidtld_common", "TLD invalidtld does not exist");
runNameTestExpectedFailure(
"invalidtld_common",
"The name must be in the format {tld|common}_list-name, yet TLD invalidtld does not exist");
}
@Test
@@ -70,6 +70,18 @@ public class CreatePremiumListActionTest {
assertThat(error).contains("A premium list of this name already exists");
}
@Test
void test_nonExistentTld_fails() {
action.name = "zanzibar";
action.inputData = "zanzibar,USD 100";
action.run();
assertThat(response.getResponseMap().get("status")).isEqualTo("error");
assertThat(response.getResponseMap().get("error").toString())
.isEqualTo(
"Premium names must match the name of the TLD they are intended to be used on"
+ " (unless --override is specified), yet TLD zanzibar does not exist");
}
@Test
void test_nonExistentTld_successWithOverride() {
action.name = "zanzibar";