Update affected Rackspace compute tests.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/56b13488 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/56b13488 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/56b13488 Branch: refs/heads/trunk Commit: 56b13488e53e50f79753956ab64a57209ec2743b Parents: baa1567 Author: Tomaz Muraus <[email protected]> Authored: Mon Oct 14 22:06:00 2013 +0200 Committer: Tomaz Muraus <[email protected]> Committed: Mon Oct 14 22:06:00 2013 +0200 ---------------------------------------------------------------------- .../compute/fixtures/openstack/_v1_1__auth.json | 4 ++-- libcloud/test/compute/test_openstack.py | 17 +++++++++++++++-- libcloud/test/compute/test_rackspace.py | 10 +--------- 3 files changed, 18 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/56b13488/libcloud/test/compute/fixtures/openstack/_v1_1__auth.json ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/fixtures/openstack/_v1_1__auth.json b/libcloud/test/compute/fixtures/openstack/_v1_1__auth.json index d8ddaf6..ab45d58 100644 --- a/libcloud/test/compute/fixtures/openstack/_v1_1__auth.json +++ b/libcloud/test/compute/fixtures/openstack/_v1_1__auth.json @@ -1,8 +1,8 @@ { "auth": { "token": { - "id": "603d2bd9-f45c-4583-b91c-2c8eac0b5654", - "expires": "2011-09-18T02:44:17.000-05:00" + "id": "aaaaaaaaaaaa-bbb-cccccccccccccc", + "expires": "2011-11-23T21:00:14-06:00" }, "serviceCatalog": { "cloudFilesCDN": [ http://git-wip-us.apache.org/repos/asf/libcloud/blob/56b13488/libcloud/test/compute/test_openstack.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py index 32dc91e..6374dbb 100644 --- a/libcloud/test/compute/test_openstack.py +++ b/libcloud/test/compute/test_openstack.py @@ -259,15 +259,18 @@ class OpenStack_1_0_Tests(unittest.TestCase, TestCaseMixin): def test_auth_token_is_set(self): self.driver.connection._populate_hosts_and_request_paths() - self.assertEqual(self.driver.connection.auth_token, "603d2bd9-f45c-4583-b91c-2c8eac0b5654") + self.assertEqual(self.driver.connection.auth_token, "aaaaaaaaaaaa-bbb-cccccccccccccc") def test_auth_token_expires_is_set(self): self.driver.connection._populate_hosts_and_request_paths() expires = self.driver.connection.auth_token_expires - self.assertEqual(expires.isoformat(), "2011-09-18T02:44:17-05:00") + self.assertEqual(expires.isoformat(), "2011-11-23T21:00:14-06:00") def test_auth(self): + if self.driver.connection._auth_version == '2.0': + return + OpenStackMockHttp.type = 'UNAUTHORIZED' try: self.driver = self.create_driver() @@ -279,6 +282,9 @@ class OpenStack_1_0_Tests(unittest.TestCase, TestCaseMixin): self.fail('test should have thrown') def test_auth_missing_key(self): + if self.driver.connection._auth_version == '2.0': + return + OpenStackMockHttp.type = 'UNAUTHORIZED_MISSING_KEY' try: self.driver = self.create_driver() @@ -290,6 +296,9 @@ class OpenStack_1_0_Tests(unittest.TestCase, TestCaseMixin): self.fail('test should have thrown') def test_auth_server_error(self): + if self.driver.connection._auth_version == '2.0': + return + OpenStackMockHttp.type = 'INTERNAL_SERVER_ERROR' try: self.driver = self.create_driver() @@ -578,6 +587,10 @@ class OpenStackMockHttp(MockHttpTestCase): 'x-cdn-management-url': 'https://cdn.clouddrive.com/v1/MossoCloudFS_FE011C19-CF86-4F87-BE5D-9229145D7A06'} return (httplib.NO_CONTENT, "", headers, httplib.responses[httplib.NO_CONTENT]) + def _v2_0_tokens(self, method, url, body, headers): + body = self.auth_fixtures.load('_v2_0__auth.json') + return (httplib.OK, body, self.json_content_headers, httplib.responses[httplib.OK]) + def _v1_0_slug_servers_detail_EMPTY(self, method, url, body, headers): body = self.fixtures.load('v1_slug_servers_detail_empty.xml') return (httplib.OK, body, XML_HEADERS, httplib.responses[httplib.OK]) http://git-wip-us.apache.org/repos/asf/libcloud/blob/56b13488/libcloud/test/compute/test_rackspace.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_rackspace.py b/libcloud/test/compute/test_rackspace.py index 4f8ef87..002747a 100644 --- a/libcloud/test/compute/test_rackspace.py +++ b/libcloud/test/compute/test_rackspace.py @@ -19,7 +19,7 @@ from libcloud.utils.py3 import method_type from libcloud.utils.py3 import httplib from libcloud.compute.providers import DEPRECATED_RACKSPACE_PROVIDERS from libcloud.compute.providers import get_driver -from libcloud.common.rackspace import AUTH_URL_US, AUTH_URL_UK +from libcloud.common.rackspace import AUTH_URL from libcloud.compute.drivers.rackspace import RackspaceFirstGenNodeDriver from libcloud.compute.drivers.rackspace import RackspaceNodeDriver from libcloud.test.compute.test_openstack import OpenStack_1_0_Tests @@ -40,10 +40,6 @@ class RackspaceusFirstGenUsTests(OpenStack_1_0_Tests): driver_args = RACKSPACE_PARAMS driver_kwargs = {'region': 'us'} - def test_auth_url_is_set(self): - self.assertEqual(self.driver.connection._ex_force_auth_url, - AUTH_URL_US) - def test_error_is_thrown_on_accessing_old_constant(self): for provider in DEPRECATED_RACKSPACE_PROVIDERS: try: @@ -70,10 +66,6 @@ class RackspaceusFirstGenUkTests(OpenStack_1_0_Tests): driver_args = RACKSPACE_PARAMS driver_kwargs = {'region': 'uk'} - def test_auth_url_is_set(self): - self.assertEqual(self.driver.connection._ex_force_auth_url, - AUTH_URL_UK) - def test_list_sizes_pricing(self): sizes = self.driver.list_sizes()
