Use autospec where appropriate
diff --git a/tests/oauth2/test_credentials.py b/tests/oauth2/test_credentials.py
index 5c76cb2..b53b188 100644
--- a/tests/oauth2/test_credentials.py
+++ b/tests/oauth2/test_credentials.py
@@ -46,7 +46,7 @@
with pytest.raises(NotImplementedError):
self.credentials.with_scopes(['email'])
- @mock.patch('google.oauth2._client.refresh_grant')
+ @mock.patch('google.oauth2._client.refresh_grant', autospec=True)
@mock.patch(
'google.auth._helpers.utcnow', return_value=datetime.datetime.min)
def test_refresh_success(self, now_mock, refresh_grant_mock):
diff --git a/tests/oauth2/test_service_account.py b/tests/oauth2/test_service_account.py
index f07f79d..678e6a3 100644
--- a/tests/oauth2/test_service_account.py
+++ b/tests/oauth2/test_service_account.py
@@ -159,7 +159,7 @@
payload = jwt.decode(token, PUBLIC_CERT_BYTES)
assert payload['sub'] == subject
- @mock.patch('google.oauth2._client.jwt_grant')
+ @mock.patch('google.oauth2._client.jwt_grant', autospec=True)
def test_refresh_success(self, jwt_grant_mock):
token = 'token'
jwt_grant_mock.return_value = (
@@ -185,7 +185,7 @@
# expired)
assert self.credentials.valid
- @mock.patch('google.oauth2._client.jwt_grant')
+ @mock.patch('google.oauth2._client.jwt_grant', autospec=True)
def test_before_request_refreshes(self, jwt_grant_mock):
token = 'token'
jwt_grant_mock.return_value = (