Skip to content

Commit 4524943

Browse files
committed
run tests only if universe helpers do not exist
1 parent 7c91b9b commit 4524943

File tree

1 file changed

+47
-47
lines changed

1 file changed

+47
-47
lines changed

tests/test_discovery.py

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2671,63 +2671,63 @@ def test_universe_env_var_configured_with_client_options_universe(self):
26712671
)
26722672

26732673
assert tasks._universe_domain == fake_universe
2674-
2675-
def test_client_options_universe_with_older_version_of_api_core(self):
2676-
fake_universe = "foo.com"
2677-
credentials = mock.Mock(spec=google.auth.credentials.Credentials)
2678-
credentials.universe_domain = fake_universe
2679-
discovery = read_datafile("tasks.json")
2680-
with self.assertRaises(APICoreVersionError):
2681-
tasks = build_from_document(
2682-
discovery,
2683-
credentials=credentials,
2684-
client_options=google.api_core.client_options.ClientOptions(
2685-
universe_domain=fake_universe
2686-
),
2687-
)
2674+
else:
2675+
def test_client_options_universe_with_older_version_of_api_core(self):
2676+
fake_universe = "foo.com"
2677+
credentials = mock.Mock(spec=google.auth.credentials.Credentials)
2678+
credentials.universe_domain = fake_universe
2679+
discovery = read_datafile("tasks.json")
2680+
with self.assertRaises(APICoreVersionError):
2681+
tasks = build_from_document(
2682+
discovery,
2683+
credentials=credentials,
2684+
client_options=google.api_core.client_options.ClientOptions(
2685+
universe_domain=fake_universe
2686+
),
2687+
)
26882688

26892689

2690-
def test_credentials_universe_with_older_version_of_api_core(self):
2691-
fake_universe = "foo.com"
2692-
credentials = mock.Mock(spec=google.auth.credentials.Credentials)
2693-
credentials.universe_domain = fake_universe
2694-
discovery = read_datafile("tasks.json")
2695-
with self.assertRaises(APICoreVersionError):
2690+
def test_credentials_universe_with_older_version_of_api_core(self):
2691+
fake_universe = "foo.com"
2692+
credentials = mock.Mock(spec=google.auth.credentials.Credentials)
2693+
credentials.universe_domain = fake_universe
2694+
discovery = read_datafile("tasks.json")
2695+
with self.assertRaises(APICoreVersionError):
2696+
tasks = build_from_document(
2697+
discovery,
2698+
credentials=credentials,
2699+
)
2700+
2701+
def test_credentials_default_universe_with_older_version_of_api_core(self):
2702+
credentials = mock.Mock(spec=google.auth.credentials.Credentials)
2703+
credentials.universe_domain = "googleapis.com"
2704+
discovery = read_datafile("tasks.json")
26962705
tasks = build_from_document(
26972706
discovery,
26982707
credentials=credentials,
26992708
)
2700-
2701-
def test_credentials_default_universe_with_older_version_of_api_core(self):
2702-
credentials = mock.Mock(spec=google.auth.credentials.Credentials)
2703-
credentials.universe_domain = "googleapis.com"
2704-
discovery = read_datafile("tasks.json")
2705-
tasks = build_from_document(
2706-
discovery,
2707-
credentials=credentials,
2708-
)
2709-
2710-
def test_http_credentials_universe_with_older_version_of_api_core(self):
2711-
fake_universe = "foo.com"
2712-
http = google_auth_httplib2.AuthorizedHttp(
2713-
credentials=mock.Mock(universe_domain=fake_universe), http=build_http()
2714-
)
2715-
discovery = read_datafile("tasks.json")
2716-
with self.assertRaises(APICoreVersionError):
2709+
2710+
def test_http_credentials_universe_with_older_version_of_api_core(self):
2711+
fake_universe = "foo.com"
2712+
http = google_auth_httplib2.AuthorizedHttp(
2713+
credentials=mock.Mock(universe_domain=fake_universe), http=build_http()
2714+
)
2715+
discovery = read_datafile("tasks.json")
2716+
with self.assertRaises(APICoreVersionError):
2717+
tasks = build_from_document(
2718+
discovery,
2719+
http=http,
2720+
)
2721+
2722+
def test_http_credentials_default_universe_with_older_version_of_api_core(self):
2723+
http = google_auth_httplib2.AuthorizedHttp(
2724+
credentials=mock.Mock(universe_domain="googleapis.com"), http=build_http()
2725+
)
2726+
discovery = read_datafile("tasks.json")
27172727
tasks = build_from_document(
27182728
discovery,
27192729
http=http,
27202730
)
2721-
2722-
def test_http_credentials_default_universe_with_older_version_of_api_core(self):
2723-
http = google_auth_httplib2.AuthorizedHttp(
2724-
credentials=mock.Mock(universe_domain="googleapis.com"), http=build_http()
2725-
)
2726-
discovery = read_datafile("tasks.json")
2727-
tasks = build_from_document(
2728-
discovery,
2729-
http=http,
2730-
)
27312731

27322732

27332733
if __name__ == "__main__":

0 commit comments

Comments
 (0)