Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: fixes flaky test.
  • Loading branch information
Aza Tulepbergenov
Aza Tulepbergenov committed Nov 9, 2021
commit 24b0467dab4f3ad248b7196b519070f387724d00
13 changes: 7 additions & 6 deletions tests/unit/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def test_error_details_from_rest_response():

# See JSON schema in https://cloud.google.com/apis/design/errors#http_mapping
http_response = make_response(
json.dumps({"error": json.loads(json_format.MessageToJson(status))}).encode(
json.dumps({"error": json.loads(json_format.MessageToJson(status, sort_keys=True))}).encode(
"utf-8"
)
)
Expand All @@ -312,18 +312,19 @@ def test_error_details_from_rest_response():
json.loads(json_format.MessageToJson(error_info_detail)),
]
assert want_error_details == exception.details

# 404 POST comes from make_response.
assert str(exception) == (
"404 POST https://example.com/: 3 INVALID_ARGUMENT:"
" One of content, or gcs_content_uri must be set."
" [{'@type': 'type.googleapis.com/google.rpc.BadRequest',"
" 'fieldViolations': [{'field': 'document.content',"
" 'description': 'Must have some text content to annotate.'}]},"
" 'fieldViolations': [{'description': 'Must have some text content to annotate.',"
" 'field': 'document.content'}]},"
" {'@type': 'type.googleapis.com/google.rpc.ErrorInfo',"
" 'reason': 'SERVICE_DISABLED',"
" 'domain': 'googleapis.com',"
" 'metadata': {'service': 'translate.googleapis.com',"
" 'consumer': 'projects/455411330361'}}]"
" 'metadata': {'consumer': 'projects/455411330361',"
" 'service': 'translate.googleapis.com'},"
" 'reason': 'SERVICE_DISABLED'}]"
)


Expand Down