Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 98a0e62

Browse files
authored
tests: revise test to run without setting credentials in env (googleapis#579)
* tests: revise test to run without setting credentials in env * address review comments and mock client
1 parent 1250039 commit 98a0e62

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/unit/test__http.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ def test_mtls(self):
232232
def test_duplicate_user_agent(self):
233233
# Regression test for issue #565
234234
from google.cloud._http import ClientInfo
235-
from google.cloud.storage.client import Client
236235
from google.cloud.storage.batch import Batch
237236
from google.cloud.storage import __version__
238237

239238
client_info = ClientInfo(user_agent="test/123")
240-
client = Client(project="test-project", client_info=client_info)
241-
conn = self._make_one(client, client_info)
239+
conn = self._make_one(object(), client_info=client_info)
242240
expected_user_agent = "test/123 gcloud-python/{} ".format(__version__)
243241
self.assertEqual(conn._client_info.user_agent, expected_user_agent)
242+
243+
client = mock.Mock(_connection=conn, spec=["_connection"])
244244
batch = Batch(client)
245245
self.assertEqual(batch._client_info.user_agent, expected_user_agent)

0 commit comments

Comments
 (0)