mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-19 19:09:22 +02:00
Separated availability error tests into two
This commit is contained in:
parent
b3145b96c7
commit
a5e2e030c2
1 changed files with 7 additions and 3 deletions
|
@ -100,19 +100,23 @@ class AvailableViewTest(MockEppLib):
|
|||
response = available(request, domain="igorville")
|
||||
self.assertTrue(json.loads(response.content)["available"])
|
||||
|
||||
def test_error_handling(self):
|
||||
"""Calling with bad strings returns error (error verifying) or unavailable (invalid domain)."""
|
||||
def test_bad_string_handling(self):
|
||||
"""Calling with bad strings returns unavailable."""
|
||||
bad_string = "blah!;"
|
||||
request = self.factory.get(API_BASE_PATH + bad_string)
|
||||
request.user = self.user
|
||||
response = available(request, domain=bad_string)
|
||||
self.assertFalse(json.loads(response.content)["available"])
|
||||
|
||||
def test_error_handling(self):
|
||||
"""Error thrown while calling availabilityAPI returns error."""
|
||||
request = self.factory.get(API_BASE_PATH + "errordomain.gov")
|
||||
request.user = self.user
|
||||
# domain set to raise error returns false for availability and error message
|
||||
error_domain_response = available(request, domain="errordomain.gov")
|
||||
self.assertFalse(json.loads(error_domain_response.content)["available"])
|
||||
self.assertIn("Error finding domain availability", json.loads(error_domain_response.content)["message"])
|
||||
|
||||
|
||||
class AvailableAPITest(MockEppLib):
|
||||
|
||||
"""Test that the API can be called as expected."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue