You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Tests that we assign properties of an error correctly when returned via the alternative format.
25
+
26
+
NOTE: Claims (among other things) uses the alternative errors format.
27
+
"""
28
+
try:
29
+
claim_data=basic_claim
30
+
claim_data["tracking_code"] ="123"# Intentionally pass a bad tracking code
31
+
32
+
test_client.claim.create(**claim_data)
33
+
exceptApiErroraserror:
34
+
asserterror.http_status==404
35
+
asserterror.code=="NOT_FOUND"
36
+
asserterror.message=="The requested resource could not be found."
37
+
asserterror.errors[0] =="No eligible insurance found with provided tracking code."
38
+
assert (
39
+
error.http_body
40
+
=='{"error": {"code": "NOT_FOUND", "errors": ["No eligible insurance found with provided tracking code."], "message": "The requested resource could not be found."}}'# noqa
41
+
)
42
+
43
+
22
44
deftest_error_no_json():
23
45
"""Tests if we don't have valid JSON that we don't set the JSON body of an error."""
0 commit comments