@@ -29,7 +29,6 @@ from {{ (api.naming.module_namespace + (api.naming.versioned_module_name,) + ser
29
29
{% endif %}
30
30
from {{ (api.naming.module_namespace + (api.naming.versioned_module_name,) + service.meta.address.subpackage)|join(".") }}.services.{{ service.name|snake_case }} import transports
31
31
from {{ (api.naming.module_namespace + (api.naming.versioned_module_name,) + service.meta.address.subpackage)|join(".") }}.services.{{ service.name|snake_case }}.transports.base import _GOOGLE_AUTH_VERSION
32
- from {{ (api.naming.module_namespace + (api.naming.versioned_module_name,) + service.meta.address.subpackage)|join(".") }}.services.{{ service.name|snake_case }}.transports.base import _API_CORE_VERSION
33
32
from google.api_core import client_options
34
33
from google.api_core import exceptions as core_exceptions
35
34
from google.api_core import grpc_helpers
@@ -55,8 +54,9 @@ from google.iam.v1 import policy_pb2 # type: ignore
55
54
{% endfilter %}
56
55
57
56
58
- # TODO(busunkim): Once google-api-core >= 1.26.0 is required:
59
- # - Delete all the api-core and auth "less than" test cases
57
+ # TODO(busunkim): Once google-auth >= 1.25.0 is required transitively
58
+ # through google-api-core:
59
+ # - Delete the auth "less than" test cases
60
60
# - Delete these pytest markers (Make the "greater than or equal to" tests the default).
61
61
requires_google_auth_lt_1_25_0 = pytest.mark.skipif(
62
62
packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"),
@@ -67,16 +67,6 @@ requires_google_auth_gte_1_25_0 = pytest.mark.skipif(
67
67
reason="This test requires google-auth >= 1.25.0",
68
68
)
69
69
70
- requires_api_core_lt_1_26_0 = pytest.mark.skipif(
71
- packaging.version.parse(_API_CORE_VERSION) >= packaging.version.parse("1.26.0"),
72
- reason="This test requires google-api-core < 1.26.0",
73
- )
74
-
75
- requires_api_core_gte_1_26_0 = pytest.mark.skipif(
76
- packaging.version.parse(_API_CORE_VERSION) < packaging.version.parse("1.26.0"),
77
- reason="This test requires google-api-core >= 1.26.0",
78
- )
79
-
80
70
def client_cert_source_callback():
81
71
return b"cert bytes", b"key bytes"
82
72
@@ -1610,7 +1600,6 @@ def test_{{ service.name|snake_case }}_transport_auth_adc_old_google_auth(transp
1610
1600
(transports.{{ service.name }}GrpcAsyncIOTransport, grpc_helpers_async)
1611
1601
],
1612
1602
)
1613
- @requires_api_core_gte_1_26_0
1614
1603
def test_{{ service.name|snake_case }}_transport_create_channel(transport_class, grpc_helpers):
1615
1604
# If credentials and host are not provided, the transport class should use
1616
1605
# ADC credentials.
@@ -1644,78 +1633,6 @@ def test_{{ service.name|snake_case }}_transport_create_channel(transport_class,
1644
1633
)
1645
1634
{% endwith %}
1646
1635
1647
-
1648
- @pytest.mark.parametrize(
1649
- "transport_class,grpc_helpers",
1650
- [
1651
- (transports.{{ service.name }}GrpcTransport, grpc_helpers),
1652
- (transports.{{ service.name }}GrpcAsyncIOTransport, grpc_helpers_async)
1653
- ],
1654
- )
1655
- @requires_api_core_lt_1_26_0
1656
- def test_{{ service.name|snake_case }}_transport_create_channel_old_api_core(transport_class, grpc_helpers):
1657
- # If credentials and host are not provided, the transport class should use
1658
- # ADC credentials.
1659
- with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch.object(
1660
- grpc_helpers, "create_channel", autospec=True
1661
- ) as create_channel:
1662
- creds = ga_credentials.AnonymousCredentials()
1663
- adc.return_value = (creds, None)
1664
- transport_class(quota_project_id="octopus")
1665
-
1666
- {% with host = (service .host |default ('localhost' , true )) %}
1667
- create_channel.assert_called_with(
1668
- "{{ host }}{% if ":" not in service .host %} :443{% endif %} ",
1669
- credentials=creds,
1670
- credentials_file=None,
1671
- quota_project_id="octopus",
1672
- scopes=(
1673
- {% for scope in service .oauth_scopes %}
1674
- '{{ scope }}',
1675
- {% endfor %} ),
1676
- ssl_credentials=None,
1677
- options=[
1678
- ("grpc.max_send_message_length", -1),
1679
- ("grpc.max_receive_message_length", -1),
1680
- ],
1681
- )
1682
- {% endwith %}
1683
-
1684
-
1685
- @pytest.mark.parametrize(
1686
- "transport_class,grpc_helpers",
1687
- [
1688
- (transports.{{ service.name }}GrpcTransport, grpc_helpers),
1689
- (transports.{{ service.name }}GrpcAsyncIOTransport, grpc_helpers_async)
1690
- ],
1691
- )
1692
- @requires_api_core_lt_1_26_0
1693
- def test_{{ service.name|snake_case }}_transport_create_channel_user_scopes(transport_class, grpc_helpers):
1694
- # If credentials and host are not provided, the transport class should use
1695
- # ADC credentials.
1696
- with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch.object(
1697
- grpc_helpers, "create_channel", autospec=True
1698
- ) as create_channel:
1699
- creds = ga_credentials.AnonymousCredentials()
1700
- adc.return_value = (creds, None)
1701
- {% with host = (service .host |default ('localhost' , true )) %}
1702
-
1703
- transport_class(quota_project_id="octopus", scopes=["1", "2"])
1704
-
1705
- create_channel.assert_called_with(
1706
- "{{ host }}{% if ":" not in service .host %} :443{% endif %} ",
1707
- credentials=creds,
1708
- credentials_file=None,
1709
- quota_project_id="octopus",
1710
- scopes=["1", "2"],
1711
- ssl_credentials=None,
1712
- options=[
1713
- ("grpc.max_send_message_length", -1),
1714
- ("grpc.max_receive_message_length", -1),
1715
- ],
1716
- )
1717
- {% endwith %}
1718
-
1719
1636
{% endif %}
1720
1637
1721
1638
{% if 'grpc' in opts .transport %}
0 commit comments