Skip to content

Commit 572685c

Browse files
committed
made unit tests compatible with google-api-python-client 1.4.2
1 parent 4bb5051 commit 572685c

File tree

5 files changed

+308
-312
lines changed

5 files changed

+308
-312
lines changed

fleet/v1/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def __init__(self, endpoint, http=None):
6060
self._service = build(
6161
self._API,
6262
self._VERSION,
63+
cache_discovery=False,
6364
discoveryServiceUrl=discovery_url,
6465
http=self._http
6566
)
@@ -123,7 +124,7 @@ def _single_request(self, method, *args, **kwargs):
123124
try:
124125
return _method.execute(http=self._http)
125126
except googleapiclient.errors.HttpError as exc:
126-
response = json.loads(exc.content)['error']
127+
response = json.loads(exc.content.decode('utf-8'))['error']
127128

128129
raise APIError(code=response['code'], message=response['message'], http_error=exc)
129130

fleet/v1/tests/fixtures/empty_response.txt

Whitespace-only changes.

fleet/v1/tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def test_init_endpoint_active_but_invalid(self):
3636
def test():
3737

3838
http = HttpMock(
39-
None,
40-
{'status': '404'}
39+
os.path.join(self._BASE_DIR, 'fixtures/empty_response.txt'),
40+
{'status': '404'},
4141
)
4242

4343
Client(self.endpoint, http=http)

0 commit comments

Comments
 (0)