Skip to content

Commit aebd030

Browse files
author
Jon Wayne Parrott
authored
Add test for GCE default credentials (#62)
1 parent b551ef2 commit aebd030

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

system_tests/test_compute_engine.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import pytest
1616

17+
import google.auth
1718
from google.auth import _helpers
1819
from google.auth import compute_engine
1920
from google.auth.compute_engine import _metadata
@@ -36,3 +37,11 @@ def test_refresh(http_request, token_info):
3637
info = token_info(credentials.token)
3738
info_scopes = _helpers.string_to_scopes(info['scope'])
3839
assert set(info_scopes) == set(credentials.scopes)
40+
41+
42+
def test_default(verify_refresh):
43+
credentials, project_id = google.auth.default()
44+
45+
assert project_id is not None
46+
assert isinstance(credentials, compute_engine.Credentials)
47+
verify_refresh(credentials)

system_tests/test_default.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
EXPECT_PROJECT_ID = os.environ.get('EXPECT_PROJECT_ID')
2020

2121

22-
def test_explicit_credentials(verify_refresh):
22+
def test_application_default_credentials(verify_refresh):
2323
credentials, project_id = google.auth.default()
2424

2525
if EXPECT_PROJECT_ID is not None:

0 commit comments

Comments
 (0)