Test a nicely formed, expected error response.
(self)
| 75 | """Test handling of error bodies.""" |
| 76 | |
| 77 | def test_json_body(self): |
| 78 | """Test a nicely formed, expected error response.""" |
| 79 | resp, content = fake_response( |
| 80 | JSON_ERROR_CONTENT, |
| 81 | {"status": "400", "content-type": "application/json"}, |
| 82 | reason="Failed", |
| 83 | ) |
| 84 | error = HttpError(resp, content, uri="http://example.org") |
| 85 | self.assertEqual(error.error_details, "error details") |
| 86 | self.assertEqual(error.status_code, 400) |
| 87 | self.assertEqual( |
| 88 | str(error), |
| 89 | '<HttpError 400 when requesting http://example.org returned "country is required". Details: "error details">', |
| 90 | ) |
| 91 | |
| 92 | def test_bad_json_body(self): |
| 93 | """Test handling of bodies with invalid json.""" |
nothing calls this directly
no test coverage detected