@@ -94,7 +94,7 @@ def test_bad_json_body(self):
94
94
b"{" , {"status" : "400" , "content-type" : "application/json" }, reason = "Failed"
95
95
)
96
96
error = HttpError (resp , content )
97
- self .assertEqual (str (error ), '<HttpError 400 "Failed">' )
97
+ self .assertEqual (str (error ), '<HttpError 400 when requesting None returned "Failed". Details: "{ ">' )
98
98
99
99
def test_with_uri (self ):
100
100
"""Test handling of passing in the request uri."""
@@ -106,7 +106,7 @@ def test_with_uri(self):
106
106
error = HttpError (resp , content , uri = "http://example.org" )
107
107
self .assertEqual (
108
108
str (error ),
109
- '<HttpError 400 when requesting http://example.org returned "Failure">' ,
109
+ '<HttpError 400 when requesting http://example.org returned "Failure". Details: "{" >' ,
110
110
)
111
111
112
112
def test_missing_message_json_body (self ):
@@ -121,15 +121,15 @@ def test_missing_message_json_body(self):
121
121
122
122
def test_non_json (self ):
123
123
"""Test handling of non-JSON bodies"""
124
- resp , content = fake_response (b"}NOT OK " , {"status" : "400" })
124
+ resp , content = fake_response (b"Invalid request " , {"status" : "400" })
125
125
error = HttpError (resp , content )
126
- self .assertEqual (str (error ), '<HttpError 400 "Ok">' )
126
+ self .assertEqual (str (error ), '<HttpError 400 when requesting None returned "Ok". Details: "Invalid request ">' )
127
127
128
128
def test_missing_reason (self ):
129
129
"""Test an empty dict with a missing resp.reason."""
130
130
resp , content = fake_response (b"}NOT OK" , {"status" : "400" }, reason = None )
131
131
error = HttpError (resp , content )
132
- self .assertEqual (str (error ), '<HttpError 400 " ">' )
132
+ self .assertEqual (str (error ), '<HttpError 400 when requesting None returned "". Details: "}NOT OK ">' )
133
133
134
134
def test_error_detail_for_missing_message_in_error (self ):
135
135
"""Test handling of data with missing 'details' or 'detail' element."""
0 commit comments