aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanny Hermes <daniel.j.hermes@gmail.com>2016-02-19 14:31:09 -0800
committerDanny Hermes <daniel.j.hermes@gmail.com>2016-02-19 14:31:09 -0800
commit0c7996099f9e3d74f7b9a6d32b6f69f44987638a (patch)
tree06f3fd9b9f54043fbef993ea6d13521f4f16cee8 /tests
parent24241309cae7cb6b3ca5ff8ee32cc26d69bddaf8 (diff)
parenta2857cb1352b37f7d6bfb5fcbf2e1067e589b56a (diff)
downloadoauth2client-0c7996099f9e3d74f7b9a6d32b6f69f44987638a.tar.gz
Merge pull request #411 from dhermes/fix-gce-acquire
Fixing broken token acquire endpoint on GCE.
Diffstat (limited to 'tests')
-rw-r--r--tests/contrib/test_gce.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/contrib/test_gce.py b/tests/contrib/test_gce.py
index add4231..b61576c 100644
--- a/tests/contrib/test_gce.py
+++ b/tests/contrib/test_gce.py
@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Tests for oauth2client.contrib.gce.
-
-Unit tests for oauth2client.contrib.gce.
-"""
+"""Unit tests for oauth2client.contrib.gce."""
import json
from six.moves import http_client
@@ -54,7 +51,7 @@ class AppAssertionCredentialsTests(unittest.TestCase):
def _refresh_success_helper(self, bytes_response=False):
access_token = u'this-is-a-token'
- return_val = json.dumps({u'accessToken': access_token})
+ return_val = json.dumps({u'access_token': access_token})
if bytes_response:
return_val = _to_bytes(return_val)
http = mock.MagicMock()
@@ -69,7 +66,7 @@ class AppAssertionCredentialsTests(unittest.TestCase):
base_metadata_uri = (
'http://metadata.google.internal/computeMetadata/v1/instance/'
- 'service-accounts/default/acquire')
+ 'service-accounts/default/token')
escaped_scopes = urllib.parse.quote(' '.join(scopes), safe='')
request_uri = base_metadata_uri + '?scope=' + escaped_scopes
http.request.assert_called_once_with(
@@ -153,7 +150,7 @@ class AppAssertionCredentialsTests(unittest.TestCase):
http = mock.MagicMock()
http.request = mock.MagicMock(
return_value=(mock.Mock(status=http_client.OK),
- '{"accessToken": "this-is-a-token"}'))
+ '{"access_token": "this-is-a-token"}'))
credentials = AppAssertionCredentials(['dummy_scope'])
token = credentials.get_access_token(http=http)
@@ -162,7 +159,7 @@ class AppAssertionCredentialsTests(unittest.TestCase):
http.request.assert_called_once_with(
'http://metadata.google.internal/computeMetadata/v1/instance/'
- 'service-accounts/default/acquire?scope=dummy_scope',
+ 'service-accounts/default/token?scope=dummy_scope',
headers={'Metadata-Flavor': 'Google'})
def test_save_to_well_known_file(self):