MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / test_json_body

Method test_json_body

tests/test_errors.py:77–90  ·  view source on GitHub ↗

Test a nicely formed, expected error response.

(self)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 2

HttpErrorClass · 0.90
fake_responseFunction · 0.85

Tested by

no test coverage detected