diff --git a/src/api/tests/test_available.py b/src/api/tests/test_available.py index 412dae64b..2bd6c70a6 100644 --- a/src/api/tests/test_available.py +++ b/src/api/tests/test_available.py @@ -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."""