Skip to content
Merged
Changes from all commits
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
20 changes: 12 additions & 8 deletions packages/google-cloud-storage/tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ def test_ctor_wo_project(self):
PROJECT = "PROJECT"
credentials = _make_credentials(project=PROJECT)

client = self._make_one(credentials=credentials)
with mock.patch.dict("os.environ", {}, clear=True):
client = self._make_one(credentials=credentials)

self.assertEqual(client.project, PROJECT)
self.assertIsInstance(client._connection, Connection)
Expand Down Expand Up @@ -368,10 +369,11 @@ def test_ctor_w_custom_endpoint_use_auth(self):

def test_ctor_w_custom_endpoint_bypass_auth(self):
custom_endpoint = "storage-example.p.googleapis.com"
client = self._make_one(
client_options={"api_endpoint": custom_endpoint},
use_auth_w_custom_endpoint=False,
)
with mock.patch.dict("os.environ", {}, clear=True):
client = self._make_one(
client_options={"api_endpoint": custom_endpoint},
use_auth_w_custom_endpoint=False,
)
self.assertEqual(client._connection.API_BASE_URL, custom_endpoint)
self.assertEqual(client.project, None)
self.assertIsInstance(client._connection, Connection)
Expand All @@ -381,9 +383,11 @@ def test_ctor_w_custom_endpoint_w_credentials(self):
PROJECT = "PROJECT"
custom_endpoint = "storage-example.p.googleapis.com"
credentials = _make_credentials(project=PROJECT)
client = self._make_one(
credentials=credentials, client_options={"api_endpoint": custom_endpoint}
)
with mock.patch.dict("os.environ", {}, clear=True):
client = self._make_one(
credentials=credentials,
client_options={"api_endpoint": custom_endpoint},
)
self.assertEqual(client._connection.API_BASE_URL, custom_endpoint)
self.assertEqual(client.project, PROJECT)
self.assertIsInstance(client._connection, Connection)
Expand Down
Loading