Skip to content

Commit

Permalink
tests: revise test to run without setting credentials in env (#579)
Browse files Browse the repository at this point in the history
* tests: revise test to run without setting credentials in env

* address review comments and mock client
  • Loading branch information
cojenco authored Sep 7, 2021
1 parent 1250039 commit 98a0e62
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/unit/test__http.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,14 @@ def test_mtls(self):
def test_duplicate_user_agent(self):
# Regression test for issue #565
from google.cloud._http import ClientInfo
from google.cloud.storage.client import Client
from google.cloud.storage.batch import Batch
from google.cloud.storage import __version__

client_info = ClientInfo(user_agent="test/123")
client = Client(project="test-project", client_info=client_info)
conn = self._make_one(client, client_info)
conn = self._make_one(object(), client_info=client_info)
expected_user_agent = "test/123 gcloud-python/{} ".format(__version__)
self.assertEqual(conn._client_info.user_agent, expected_user_agent)

client = mock.Mock(_connection=conn, spec=["_connection"])
batch = Batch(client)
self.assertEqual(batch._client_info.user_agent, expected_user_agent)

0 comments on commit 98a0e62

Please sign in to comment.