diff options
Diffstat (limited to 'scripts/run_gce_system_tests.py')
-rw-r--r-- | scripts/run_gce_system_tests.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/scripts/run_gce_system_tests.py b/scripts/run_gce_system_tests.py index 80794bd..d446f9c 100644 --- a/scripts/run_gce_system_tests.py +++ b/scripts/run_gce_system_tests.py @@ -13,26 +13,26 @@ # limitations under the License. import json -import unittest +import httplib2 from six.moves import http_client from six.moves import urllib +import unittest2 -import oauth2client -from oauth2client import client -from oauth2client import transport -from oauth2client.contrib import gce +from oauth2client import GOOGLE_TOKEN_INFO_URI +from oauth2client.client import GoogleCredentials +from oauth2client.contrib.gce import AppAssertionCredentials -class TestComputeEngine(unittest.TestCase): +class TestComputeEngine(unittest2.TestCase): def test_application_default(self): - default_creds = client.GoogleCredentials.get_application_default() - self.assertIsInstance(default_creds, gce.AppAssertionCredentials) + default_creds = GoogleCredentials.get_application_default() + self.assertIsInstance(default_creds, AppAssertionCredentials) def test_token_info(self): - credentials = gce.AppAssertionCredentials([]) - http = transport.get_http_object() + credentials = AppAssertionCredentials([]) + http = httplib2.Http() # First refresh to get the access token. self.assertIsNone(credentials.access_token) @@ -41,9 +41,9 @@ class TestComputeEngine(unittest.TestCase): # Then check the access token against the token info API. query_params = {'access_token': credentials.access_token} - token_uri = (oauth2client.GOOGLE_TOKEN_INFO_URI + '?' + + token_uri = (GOOGLE_TOKEN_INFO_URI + '?' + urllib.parse.urlencode(query_params)) - response, content = transport.request(http, token_uri) + response, content = http.request(token_uri) self.assertEqual(response.status, http_client.OK) content = content.decode('utf-8') @@ -53,4 +53,4 @@ class TestComputeEngine(unittest.TestCase): if __name__ == '__main__': - unittest.main() + unittest2.main() |