Add tests for "region" argument in the Rackspace compute drivers.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9d636313
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9d636313
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9d636313

Branch: refs/heads/trunk
Commit: 9d6363131ac4c8ecdbfa8c823b2ebd2ecb2fcd70
Parents: 7cb930e
Author: Tomaz Muraus <[email protected]>
Authored: Sat Oct 12 10:57:34 2013 +0200
Committer: Tomaz Muraus <[email protected]>
Committed: Sat Oct 12 10:57:34 2013 +0200

----------------------------------------------------------------------
 .../compute/fixtures/openstack/_v2_0__auth.json | 17 +++++++++++
 libcloud/test/compute/test_rackspace.py         | 30 ++++++++++++++++++--
 2 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/9d636313/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json 
b/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
index 74efacc..e381662 100644
--- a/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
+++ b/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
@@ -85,7 +85,24 @@
                         "versionInfo": 
"https://ord.servers.api.rackspacecloud.com/v2/";,
                         "versionList": 
"https://ord.servers.api.rackspacecloud.com/";,
                         "versionId": "2"
+                    },
+                    {
+                        "region": "IAD",
+                        "tenantId": "613469",
+                        "publicURL": 
"https://iad.servers.api.rackspacecloud.com/v2/1337";,
+                        "versionInfo": 
"https://iad.servers.api.rackspacecloud.com/v2/";,
+                        "versionList": 
"https://iad.servers.api.rackspacecloud.com/";,
+                        "versionId": "2"
+                    },
+                    {
+                        "region": "SYD",
+                        "tenantId": "613469",
+                        "publicURL": 
"https://syd.servers.api.rackspacecloud.com/v2/1337";,
+                        "versionInfo": 
"https://syd.servers.api.rackspacecloud.com/v2/";,
+                        "versionList": 
"https://syd.servers.api.rackspacecloud.com/";,
+                        "versionId": "2"
                     }
+
                 ],
                 "name": "cloudServersOpenStack",
                 "type": "compute"

http://git-wip-us.apache.org/repos/asf/libcloud/blob/9d636313/libcloud/test/compute/test_rackspace.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_rackspace.py 
b/libcloud/test/compute/test_rackspace.py
index c2bff33..0eaadbc 100644
--- a/libcloud/test/compute/test_rackspace.py
+++ b/libcloud/test/compute/test_rackspace.py
@@ -41,7 +41,8 @@ class RackspaceusFirstGenUsTests(OpenStack_1_0_Tests):
     driver_kwargs = {'region': 'us'}
 
     def test_auth_url_is_set(self):
-        self.assertEqual(self.driver.connection.auth_url, AUTH_URL_US)
+        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:
@@ -70,7 +71,8 @@ class RackspaceusFirstGenUkTests(OpenStack_1_0_Tests):
     driver_kwargs = {'region': 'uk'}
 
     def test_auth_url_is_set(self):
-        self.assertEqual(self.driver.connection.auth_url, AUTH_URL_UK)
+        self.assertEqual(self.driver.connection._ex_force_auth_url,
+                         AUTH_URL_UK)
 
     def test_list_sizes_pricing(self):
         sizes = self.driver.list_sizes()
@@ -92,6 +94,7 @@ class RackspaceNovaMockHttp(OpenStack_1_1_MockHttp):
             new_name = name.replace('_v1_1_slug_', '_v2_1337_')
             setattr(self, new_name, method_type(method, self,
                                                 RackspaceNovaMockHttp))
+
     def _v2_1337_os_networksv2(self, method, url, body, headers):
         if method == 'GET':
             body = self.fixtures.load('_os_networks.json')
@@ -167,6 +170,18 @@ class RackspaceNovaOrdTests(BaseRackspaceNovaTestCase):
                          self.driver.connection.get_endpoint())
 
 
+class RackspaceNovaIadTests(BaseRackspaceNovaTestCase):
+
+    driver_klass = RackspaceNodeDriver
+    driver_type = RackspaceNodeDriver
+    driver_args = RACKSPACE_NOVA_PARAMS
+    driver_kwargs = {'region': 'iad'}
+
+    def test_service_catalog(self):
+        self.assertEqual('https://iad.servers.api.rackspacecloud.com/v2/1337',
+                         self.driver.connection.get_endpoint())
+
+
 class RackspaceNovaLonTests(BaseRackspaceNovaTestCase):
 
     driver_klass = RackspaceNodeDriver
@@ -189,5 +204,16 @@ class RackspaceNovaLonTests(BaseRackspaceNovaTestCase):
                          self.driver.connection.get_endpoint())
 
 
+class RackspaceNovaSydTests(BaseRackspaceNovaTestCase):
+
+    driver_klass = RackspaceNodeDriver
+    driver_type = RackspaceNodeDriver
+    driver_args = RACKSPACE_NOVA_PARAMS
+    driver_kwargs = {'region': 'syd'}
+
+    def test_service_catalog(self):
+        self.assertEqual('https://syd.servers.api.rackspacecloud.com/v2/1337',
+                         self.driver.connection.get_endpoint())
+
 if __name__ == '__main__':
     sys.exit(unittest.main())

Reply via email to