Skip to content

Commit

Permalink
Add test for GCE default credentials (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Wayne Parrott authored Oct 28, 2016
1 parent b551ef2 commit aebd030
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions system_tests/test_compute_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import pytest

import google.auth
from google.auth import _helpers
from google.auth import compute_engine
from google.auth.compute_engine import _metadata
Expand All @@ -36,3 +37,11 @@ def test_refresh(http_request, token_info):
info = token_info(credentials.token)
info_scopes = _helpers.string_to_scopes(info['scope'])
assert set(info_scopes) == set(credentials.scopes)


def test_default(verify_refresh):
credentials, project_id = google.auth.default()

assert project_id is not None
assert isinstance(credentials, compute_engine.Credentials)
verify_refresh(credentials)
2 changes: 1 addition & 1 deletion system_tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
EXPECT_PROJECT_ID = os.environ.get('EXPECT_PROJECT_ID')


def test_explicit_credentials(verify_refresh):
def test_application_default_credentials(verify_refresh):
credentials, project_id = google.auth.default()

if EXPECT_PROJECT_ID is not None:
Expand Down

0 comments on commit aebd030

Please sign in to comment.