diff --git a/google/cloud/monitoring_dashboard_v1/services/dashboards_service/async_client.py b/google/cloud/monitoring_dashboard_v1/services/dashboards_service/async_client.py index df96c58..f3740b6 100644 --- a/google/cloud/monitoring_dashboard_v1/services/dashboards_service/async_client.py +++ b/google/cloud/monitoring_dashboard_v1/services/dashboards_service/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.monitoring_dashboard_v1.services.dashboards_service import pagers from google.cloud.monitoring_dashboard_v1.types import dashboard from google.cloud.monitoring_dashboard_v1.types import dashboards_service @@ -171,9 +173,9 @@ def __init__( async def create_dashboard( self, - request: dashboards_service.CreateDashboardRequest = None, + request: Union[dashboards_service.CreateDashboardRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dashboard.Dashboard: @@ -186,7 +188,7 @@ async def create_dashboard( Management `__. Args: - request (:class:`google.cloud.monitoring_dashboard_v1.types.CreateDashboardRequest`): + request (Union[google.cloud.monitoring_dashboard_v1.types.CreateDashboardRequest, dict]): The request object. The `CreateDashboard` request. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -227,9 +229,9 @@ async def create_dashboard( async def list_dashboards( self, - request: dashboards_service.ListDashboardsRequest = None, + request: Union[dashboards_service.ListDashboardsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDashboardsAsyncPager: @@ -241,7 +243,7 @@ async def list_dashboards( Management `__. Args: - request (:class:`google.cloud.monitoring_dashboard_v1.types.ListDashboardsRequest`): + request (Union[google.cloud.monitoring_dashboard_v1.types.ListDashboardsRequest, dict]): The request object. The `ListDashboards` request. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -288,9 +290,9 @@ async def list_dashboards( async def get_dashboard( self, - request: dashboards_service.GetDashboardRequest = None, + request: Union[dashboards_service.GetDashboardRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dashboard.Dashboard: @@ -302,7 +304,7 @@ async def get_dashboard( Management `__. Args: - request (:class:`google.cloud.monitoring_dashboard_v1.types.GetDashboardRequest`): + request (Union[google.cloud.monitoring_dashboard_v1.types.GetDashboardRequest, dict]): The request object. The `GetDashboard` request. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -343,9 +345,9 @@ async def get_dashboard( async def delete_dashboard( self, - request: dashboards_service.DeleteDashboardRequest = None, + request: Union[dashboards_service.DeleteDashboardRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -357,7 +359,7 @@ async def delete_dashboard( Management `__. Args: - request (:class:`google.cloud.monitoring_dashboard_v1.types.DeleteDashboardRequest`): + request (Union[google.cloud.monitoring_dashboard_v1.types.DeleteDashboardRequest, dict]): The request object. The `DeleteDashboard` request. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -389,9 +391,9 @@ async def delete_dashboard( async def update_dashboard( self, - request: dashboards_service.UpdateDashboardRequest = None, + request: Union[dashboards_service.UpdateDashboardRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dashboard.Dashboard: @@ -403,7 +405,7 @@ async def update_dashboard( Management `__. Args: - request (:class:`google.cloud.monitoring_dashboard_v1.types.UpdateDashboardRequest`): + request (Union[google.cloud.monitoring_dashboard_v1.types.UpdateDashboardRequest, dict]): The request object. The `UpdateDashboard` request. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. diff --git a/google/cloud/monitoring_dashboard_v1/services/dashboards_service/client.py b/google/cloud/monitoring_dashboard_v1/services/dashboards_service/client.py index b1994db..e62e3aa 100644 --- a/google/cloud/monitoring_dashboard_v1/services/dashboards_service/client.py +++ b/google/cloud/monitoring_dashboard_v1/services/dashboards_service/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.monitoring_dashboard_v1.services.dashboards_service import pagers from google.cloud.monitoring_dashboard_v1.types import dashboard from google.cloud.monitoring_dashboard_v1.types import dashboards_service @@ -369,7 +371,7 @@ def create_dashboard( self, request: Union[dashboards_service.CreateDashboardRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dashboard.Dashboard: @@ -426,7 +428,7 @@ def list_dashboards( self, request: Union[dashboards_service.ListDashboardsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDashboardsPager: @@ -488,7 +490,7 @@ def get_dashboard( self, request: Union[dashboards_service.GetDashboardRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dashboard.Dashboard: @@ -544,7 +546,7 @@ def delete_dashboard( self, request: Union[dashboards_service.DeleteDashboardRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -591,7 +593,7 @@ def update_dashboard( self, request: Union[dashboards_service.UpdateDashboardRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dashboard.Dashboard: diff --git a/google/cloud/monitoring_dashboard_v1/services/dashboards_service/transports/base.py b/google/cloud/monitoring_dashboard_v1/services/dashboards_service/transports/base.py index 143a306..15c892c 100644 --- a/google/cloud/monitoring_dashboard_v1/services/dashboards_service/transports/base.py +++ b/google/cloud/monitoring_dashboard_v1/services/dashboards_service/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -39,15 +38,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class DashboardsServiceTransport(abc.ABC): """Abstract transport class for DashboardsService.""" @@ -102,7 +92,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -135,29 +125,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/monitoring_dashboard_v1/services/dashboards_service/transports/grpc_asyncio.py b/google/cloud/monitoring_dashboard_v1/services/dashboards_service/transports/grpc_asyncio.py index 93bf46c..fc8a54b 100644 --- a/google/cloud/monitoring_dashboard_v1/services/dashboards_service/transports/grpc_asyncio.py +++ b/google/cloud/monitoring_dashboard_v1/services/dashboards_service/transports/grpc_asyncio.py @@ -20,7 +20,6 @@ from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore diff --git a/google/cloud/monitoring_dashboard_v1/types/dashboard.py b/google/cloud/monitoring_dashboard_v1/types/dashboard.py index e6acaa4..42b6b48 100644 --- a/google/cloud/monitoring_dashboard_v1/types/dashboard.py +++ b/google/cloud/monitoring_dashboard_v1/types/dashboard.py @@ -27,6 +27,13 @@ class Dashboard(proto.Message): r"""A Google Stackdriver dashboard. Dashboards define the content and layout of pages in the Stackdriver web application. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: name (str): Immutable. The resource name of the @@ -46,16 +53,20 @@ class Dashboard(proto.Message): Content is arranged with a basic layout that re-flows a simple list of informational elements like widgets or tiles. + This field is a member of `oneof`_ ``layout``. mosaic_layout (google.cloud.monitoring_dashboard_v1.types.MosaicLayout): The content is arranged as a grid of tiles, with each content widget occupying one or more grid blocks. + This field is a member of `oneof`_ ``layout``. row_layout (google.cloud.monitoring_dashboard_v1.types.RowLayout): The content is divided into equally spaced rows and the widgets are arranged horizontally. + This field is a member of `oneof`_ ``layout``. column_layout (google.cloud.monitoring_dashboard_v1.types.ColumnLayout): The content is divided into equally spaced columns and the widgets are arranged vertically. + This field is a member of `oneof`_ ``layout``. """ name = proto.Field(proto.STRING, number=1,) diff --git a/google/cloud/monitoring_dashboard_v1/types/metrics.py b/google/cloud/monitoring_dashboard_v1/types/metrics.py index abcaa68..164e973 100644 --- a/google/cloud/monitoring_dashboard_v1/types/metrics.py +++ b/google/cloud/monitoring_dashboard_v1/types/metrics.py @@ -43,14 +43,24 @@ class TimeSeriesQuery(proto.Message): r"""TimeSeriesQuery collects the set of supported methods for querying time series data from the Stackdriver metrics API. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: time_series_filter (google.cloud.monitoring_dashboard_v1.types.TimeSeriesFilter): Filter parameters to fetch time series. + This field is a member of `oneof`_ ``source``. time_series_filter_ratio (google.cloud.monitoring_dashboard_v1.types.TimeSeriesFilterRatio): Parameters to fetch a ratio between two time series filters. + This field is a member of `oneof`_ ``source``. time_series_query_language (str): A query used to fetch time series. + This field is a member of `oneof`_ ``source``. unit_override (str): The unit of data contained in fetched time series. If non-empty, this unit will override any unit that accompanies @@ -75,6 +85,13 @@ class TimeSeriesFilter(proto.Message): ```ListTimeSeries`` `__ method. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: filter (str): Required. The `monitoring @@ -89,10 +106,12 @@ class TimeSeriesFilter(proto.Message): Apply a second aggregation after ``aggregation`` is applied. pick_time_series_filter (google.cloud.monitoring_dashboard_v1.types.PickTimeSeriesFilter): Ranking based time series filter. + This field is a member of `oneof`_ ``output_filter``. statistical_time_series_filter (google.cloud.monitoring_dashboard_v1.types.StatisticalTimeSeriesFilter): Statistics based time series filter. Note: This field is deprecated and completely ignored by the API. + This field is a member of `oneof`_ ``output_filter``. """ filter = proto.Field(proto.STRING, number=1,) @@ -120,6 +139,13 @@ class TimeSeriesFilterRatio(proto.Message): each aligned element from the numerator and denominator time series. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: numerator (google.cloud.monitoring_dashboard_v1.types.TimeSeriesFilterRatio.RatioPart): The numerator of the ratio. @@ -130,10 +156,12 @@ class TimeSeriesFilterRatio(proto.Message): computed. pick_time_series_filter (google.cloud.monitoring_dashboard_v1.types.PickTimeSeriesFilter): Ranking based time series filter. + This field is a member of `oneof`_ ``output_filter``. statistical_time_series_filter (google.cloud.monitoring_dashboard_v1.types.StatisticalTimeSeriesFilter): Statistics based time series filter. Note: This field is deprecated and completely ignored by the API. + This field is a member of `oneof`_ ``output_filter``. """ class RatioPart(proto.Message): diff --git a/google/cloud/monitoring_dashboard_v1/types/scorecard.py b/google/cloud/monitoring_dashboard_v1/types/scorecard.py index 7dc885b..2ecb552 100644 --- a/google/cloud/monitoring_dashboard_v1/types/scorecard.py +++ b/google/cloud/monitoring_dashboard_v1/types/scorecard.py @@ -28,6 +28,13 @@ class Scorecard(proto.Message): r"""A widget showing the latest value of a metric, and how this value relates to one or more thresholds. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: time_series_query (google.cloud.monitoring_dashboard_v1.types.TimeSeriesQuery): Required. Fields for querying time series @@ -35,9 +42,11 @@ class Scorecard(proto.Message): gauge_view (google.cloud.monitoring_dashboard_v1.types.Scorecard.GaugeView): Will cause the scorecard to show a gauge chart. + This field is a member of `oneof`_ ``data_view``. spark_chart_view (google.cloud.monitoring_dashboard_v1.types.Scorecard.SparkChartView): Will cause the scorecard to show a spark chart. + This field is a member of `oneof`_ ``data_view``. thresholds (Sequence[google.cloud.monitoring_dashboard_v1.types.Threshold]): The thresholds used to determine the state of the scorecard given the time series' current diff --git a/google/cloud/monitoring_dashboard_v1/types/widget.py b/google/cloud/monitoring_dashboard_v1/types/widget.py index 1b74bca..d870a67 100644 --- a/google/cloud/monitoring_dashboard_v1/types/widget.py +++ b/google/cloud/monitoring_dashboard_v1/types/widget.py @@ -31,20 +31,32 @@ class Widget(proto.Message): r"""Widget contains a single dashboard component and configuration of how to present the component in the dashboard. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: title (str): Optional. The title of the widget. xy_chart (google.cloud.monitoring_dashboard_v1.types.XyChart): A chart of time series data. + This field is a member of `oneof`_ ``content``. scorecard (google.cloud.monitoring_dashboard_v1.types.Scorecard): A scorecard summarizing time series data. + This field is a member of `oneof`_ ``content``. text (google.cloud.monitoring_dashboard_v1.types.Text): A raw string or markdown displaying textual content. + This field is a member of `oneof`_ ``content``. blank (google.protobuf.empty_pb2.Empty): A blank space. + This field is a member of `oneof`_ ``content``. alert_chart (google.cloud.monitoring_dashboard_v1.types.AlertChart): A chart of alert policy data. + This field is a member of `oneof`_ ``content``. """ title = proto.Field(proto.STRING, number=1,) diff --git a/setup.py b/setup.py index 0ba25c6..9a0d899 100644 --- a/setup.py +++ b/setup.py @@ -28,9 +28,8 @@ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 - "google-api-core[grpc] >= 1.26.0, <3.0.0dev", + "google-api-core[grpc] >= 1.28.0, <3.0.0dev", "proto-plus >= 0.4.0", - "packaging >= 14.3", ] extras = {"libcst": "libcst >= 0.2.5"} diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index b237c54..79536ab 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -5,8 +5,6 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-api-core==1.26.0 +google-api-core==1.28.0 proto-plus==0.4.0 libcst==0.2.5 -packaging==14.3 -google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 si transitively required through google-api-core diff --git a/tests/unit/gapic/dashboard_v1/test_dashboards_service.py b/tests/unit/gapic/dashboard_v1/test_dashboards_service.py index 373bcb5..e0877ce 100644 --- a/tests/unit/gapic/dashboard_v1/test_dashboards_service.py +++ b/tests/unit/gapic/dashboard_v1/test_dashboards_service.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -40,9 +39,6 @@ ) from google.cloud.monitoring_dashboard_v1.services.dashboards_service import pagers from google.cloud.monitoring_dashboard_v1.services.dashboards_service import transports -from google.cloud.monitoring_dashboard_v1.services.dashboards_service.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.monitoring_dashboard_v1.types import alertchart from google.cloud.monitoring_dashboard_v1.types import common from google.cloud.monitoring_dashboard_v1.types import dashboard @@ -58,20 +54,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -229,7 +211,7 @@ def test_dashboards_service_client_client_options( options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -246,7 +228,7 @@ def test_dashboards_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -263,7 +245,7 @@ def test_dashboards_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -292,7 +274,7 @@ def test_dashboards_service_client_client_options( options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -361,7 +343,7 @@ def test_dashboards_service_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -403,7 +385,7 @@ def test_dashboards_service_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -425,7 +407,7 @@ def test_dashboards_service_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -456,7 +438,7 @@ def test_dashboards_service_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -487,7 +469,7 @@ def test_dashboards_service_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -1484,7 +1466,6 @@ def test_dashboards_service_base_transport(): transport.close() -@requires_google_auth_gte_1_25_0 def test_dashboards_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -1510,31 +1491,6 @@ def test_dashboards_service_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_dashboards_service_base_transport_with_credentials_file_old_google_auth(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.monitoring_dashboard_v1.services.dashboards_service.transports.DashboardsServiceTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.DashboardsServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.read", - "https://www.googleapis.com/auth/monitoring.write", - ), - quota_project_id="octopus", - ) - - def test_dashboards_service_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( @@ -1546,7 +1502,6 @@ def test_dashboards_service_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 def test_dashboards_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: @@ -1564,23 +1519,6 @@ def test_dashboards_service_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_dashboards_service_auth_adc_old_google_auth(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - DashboardsServiceClient() - adc.assert_called_once_with( - scopes=( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.read", - "https://www.googleapis.com/auth/monitoring.write", - ), - quota_project_id=None, - ) - - @pytest.mark.parametrize( "transport_class", [ @@ -1588,7 +1526,6 @@ def test_dashboards_service_auth_adc_old_google_auth(): transports.DashboardsServiceGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_dashboards_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1607,31 +1544,6 @@ def test_dashboards_service_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.DashboardsServiceGrpcTransport, - transports.DashboardsServiceGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_dashboards_service_transport_auth_adc_old_google_auth(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus") - adc.assert_called_once_with( - scopes=( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/monitoring.read", - "https://www.googleapis.com/auth/monitoring.write", - ), - quota_project_id="octopus", - ) - - @pytest.mark.parametrize( "transport_class,grpc_helpers", [