Add mocked responses for test_forms cases

This commit is contained in:
Erin 2023-10-20 16:10:15 -07:00
parent c75891ee90
commit 15b16583cd
No known key found for this signature in database
GPG key ID: 1CAD275313C62460
2 changed files with 6 additions and 1 deletions

View file

@ -25,6 +25,7 @@ DOMAIN_API_MESSAGES = {
"invalid": "Enter a domain using only letters," "invalid": "Enter a domain using only letters,"
" numbers, or hyphens (though we don't recommend using hyphens).", " numbers, or hyphens (though we don't recommend using hyphens).",
"success": "That domain is available!", "success": "That domain is available!",
"error": "Error finding domain availability."
} }
@ -99,4 +100,6 @@ def available(request, domain=""):
{"available": False, "message": DOMAIN_API_MESSAGES["unavailable"]} {"available": False, "message": DOMAIN_API_MESSAGES["unavailable"]}
) )
except: except:
raise RegistryError("Registry cannot find domain availability.") return JsonResponse(
{"available": False, "message": DOMAIN_API_MESSAGES["error"]}
)

View file

@ -839,6 +839,8 @@ class MockEppLib(TestCase):
return self._mockDomainName("GSA.gov", False) return self._mockDomainName("GSA.gov", False)
elif "igorville.gov" in getattr(_request, "names", None): elif "igorville.gov" in getattr(_request, "names", None):
return self._mockDomainName("igorvilleremixed.gov", True) return self._mockDomainName("igorvilleremixed.gov", True)
elif "top-level-agency.gov" in getattr(_request, "names", None):
return self._mockDomainName("top-level-agency.gov", True)
elif "errordomain.gov" in getattr(_request, "names", None): elif "errordomain.gov" in getattr(_request, "names", None):
raise RegistryError("Registry cannot find domain availability.") raise RegistryError("Registry cannot find domain availability.")
else: else: