Skip to content

Commit 7c6a0c9

Browse files
chore: Update the testcases to check against google auth version number and skip for unsupported version number
Signed-off-by: Radhika Agrawal <agrawalradhika@google.com>
1 parent d16b37f commit 7c6a0c9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_discovery.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import json
3333
import os
3434
import pickle
35+
import pytest
3536
import re
3637
import sys
3738
import unittest
@@ -40,6 +41,7 @@
4041

4142
import google.api_core.exceptions
4243
import google.auth.credentials
44+
from google.auth import __version__ as auth_version
4345
from google.auth.exceptions import MutualTLSChannelError
4446
import google_auth_httplib2
4547
import httplib2
@@ -61,6 +63,7 @@
6163
except ImportError:
6264
HAS_UNIVERSE = False
6365

66+
from google.api_core import parse_version_to_tuple
6467
from googleapiclient import _helpers as util
6568
from googleapiclient.discovery import (DISCOVERY_URI,
6669
MEDIA_BODY_PARAMETER_DEFAULT_VALUE,
@@ -889,6 +892,11 @@ def test_mtls_with_provided_client_cert(
889892
("always", "", CONFIG_DATA_WITHOUT_WORKLOAD, MTLS_ENDPOINT),
890893
]
891894
)
895+
@pytest.mark.skipif(
896+
parse_version_to_tuple(auth_version) < (2,43,0),
897+
reason="automatic mtls enablement when supported certs present only"
898+
"enabled in google-auth<=2.43.0"
899+
)
892900
def test_mtls_with_provided_client_cert_unset_environment_variable(
893901
self, use_mtls_env, use_client_cert, config_data, base_url
894902
):
@@ -1016,6 +1024,11 @@ def test_mtls_with_default_client_cert(
10161024
@mock.patch(
10171025
"google.auth.transport.mtls.default_client_encrypted_cert_source", autospec=True
10181026
)
1027+
@pytest.mark.skipif(
1028+
parse_version_to_tuple(auth_version) < (2,43,0),
1029+
reason="automatic mtls enablement when supported certs present only"
1030+
"enabled in google-auth<=2.43.0"
1031+
)
10191032
def test_mtls_with_default_client_cert_with_unset_environment_variable(
10201033
self,
10211034
use_mtls_env,

0 commit comments

Comments
 (0)