libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [2/2] git commit: Update affected storage tests.
Date Sat, 22 Jun 2013 21:48:47 GMT
Update affected storage tests.


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

Branch: refs/heads/make_rackspace_drivers_multi_datacenter_aware
Commit: 615410618d7a1ea75b3641ceaddc09108f44b5bd
Parents: 51cc274
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Sat Jun 22 23:44:39 2013 +0200
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Sat Jun 22 23:44:39 2013 +0200

----------------------------------------------------------------------
 libcloud/storage/drivers/cloudfiles.py          |   2 +-
 .../fixtures/cloudfiles/_v2_0__auth.json        | 128 +++++++++++++++++++
 libcloud/test/storage/test_cloudfiles.py        |  18 +--
 3 files changed, 139 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/61541061/libcloud/storage/drivers/cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py
index 41c5b47..e6507dc 100644
--- a/libcloud/storage/drivers/cloudfiles.py
+++ b/libcloud/storage/drivers/cloudfiles.py
@@ -829,7 +829,7 @@ class CloudFilesUKStorageDriver(CloudFilesStorageDriver):
     name = 'CloudFiles (UK)'
     _datacenter = 'lon'
 
-    def __init__(*args, **kwargs):
+    def __init__(self, *args, **kwargs):
         kwargs['datacenter'] = 'lon'
         super(CloudFilesUKStorageDriver, self).__init__(*args, **kwargs)
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/61541061/libcloud/test/storage/fixtures/cloudfiles/_v2_0__auth.json
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/fixtures/cloudfiles/_v2_0__auth.json b/libcloud/test/storage/fixtures/cloudfiles/_v2_0__auth.json
new file mode 100644
index 0000000..b9cbb9d
--- /dev/null
+++ b/libcloud/test/storage/fixtures/cloudfiles/_v2_0__auth.json
@@ -0,0 +1,128 @@
+{
+    "access": {
+        "token": {
+            "id": "aaaaaaaaaaaa-bbb-cccccccccccccc",
+            "expires": "2011-11-23T21:00:14.000-06:00"
+        },
+        "serviceCatalog": [
+            {
+                "endpoints": [
+                    {
+                        "region": "ORD",
+                        "tenantId": "MossoCloudFS_11111-111111111-1111111111-1111111",
+                        "publicURL": "https://cdn.clouddrive.com/v1/MossoCloudFS",
+                        "version": {
+                            "versionInfo": "https://cdn2.clouddrive.com/v1/",
+                            "versionList": "https://cdn2.clouddrive.com/",
+                            "versionId": "1"
+                        }
+                    },
+                    {
+                        "region": "LON",
+                        "tenantId": "MossoCloudFS_11111-111111111-1111111111-1111111",
+                        "publicURL": "https://cdn.clouddrive.com/v1/MossoCloudFS",
+                        "version": {
+                            "versionInfo": "https://cdn2.clouddrive.com/v1/",
+                            "versionList": "https://cdn2.clouddrive.com/",
+                            "versionId": "1"
+                        }
+                    }
+
+                ],
+                "name": "cloudFilesCDN",
+                "type": "object-store"
+            },
+            {
+                "endpoints": [
+                    {
+                        "region": "ORD",
+                        "tenantId": "MossoCloudFS_11111-111111111-1111111111-1111111",
+                        "publicURL": "https://storage4.ord1.clouddrive.com/v1/MossoCloudFS",
+                        "internalURL": "https://snet-storage101.ord1.clouddrive.com/v1/MossoCloudFS_11111-111111111-1111111111-1111111"
+                    },
+                    {
+                        "region": "LON",
+                        "tenantId": "MossoCloudFS_11111-111111111-1111111111-1111111",
+                        "publicURL": "https://storage4.lon1.clouddrive.com/v1/MossoCloudFS",
+                        "internalURL": "https://snet-storage101.lon1.clouddrive.com/v1/MossoCloudFS_11111-111111111-1111111111-1111111"
+                    }
+                ],
+                "name": "cloudFiles",
+                "type": "object-store"
+            },
+            {
+                "endpoints": [
+                    {
+                        "tenantId": "1337",
+                        "publicURL": "https://servers.api.rackspacecloud.com/v1.0/1337",
+                        "version": {
+                            "versionInfo": "https://servers.api.rackspacecloud.com/v1.0/",
+                            "versionList": "https://servers.api.rackspacecloud.com/",
+                            "versionId": "1.0"
+                        }
+                    }
+                ],
+                "name": "cloudServers",
+                "type": "compute"
+            },
+            {
+                "endpoints": [
+                    {
+                        "region": "RegionOne",
+                        "tenantId": "1337",
+                        "publicURL": "https://127.0.0.1/v2/1337",
+                        "versionInfo": "https://127.0.0.1/v2/",
+                        "versionList": "https://127.0.0.1/",
+                        "versionId": "2"
+                    }
+                ],
+                "name": "nova",
+                "type": "compute"
+            },
+            {
+                "endpoints": [
+                    {
+                        "region": "DFW",
+                        "tenantId": "613469",
+                        "publicURL": "https://dfw.servers.api.rackspacecloud.com/v2/1337",
+                        "versionInfo": "https://dfw.servers.api.rackspacecloud.com/v2/",
+                        "versionList": "https://dfw.servers.api.rackspacecloud.com/",
+                        "versionId": "2"
+                    },
+                    {
+                        "region": "ORD",
+                        "tenantId": "613469",
+                        "publicURL": "https://ord.servers.api.rackspacecloud.com/v2/1337",
+                        "versionInfo": "https://ord.servers.api.rackspacecloud.com/v2/",
+                        "versionList": "https://ord.servers.api.rackspacecloud.com/",
+                        "versionId": "2"
+                    }
+                ],
+                "name": "cloudServersOpenStack",
+                "type": "compute"
+            },
+            {
+                "endpoints": [
+                    {
+                        "region": "DFW",
+                        "tenantId": "1337",
+                        "publicURL": "https://preprod.dfw.servers.api.rackspacecloud.com/v2/1337"
+                    }
+                ],
+                "name": "cloudServersPreprod",
+                "type": "compute"
+            }
+        ],
+        "user": {
+            "id": "7",
+            "roles": [
+                {
+                    "id": "identity:default",
+                    "description": "Default Role.",
+                    "name": "identity:default"
+                }
+            ],
+            "name": "testuser"
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/libcloud/blob/61541061/libcloud/test/storage/test_cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_cloudfiles.py b/libcloud/test/storage/test_cloudfiles.py
index 1fd5f06..7cfb772 100644
--- a/libcloud/test/storage/test_cloudfiles.py
+++ b/libcloud/test/storage/test_cloudfiles.py
@@ -147,7 +147,7 @@ class CloudFilesTests(unittest.TestCase):
             self.fail('Exception was not thrown')
 
     def test_service_catalog(self):
-        url = 'https://storage101.%s1.clouddrive.com/v1/MossoCloudFS' % \
+        url = 'https://storage4.%s1.clouddrive.com/v1/MossoCloudFS' % \
               (self.datacenter)
         self.assertEqual(
              url,
@@ -155,7 +155,7 @@ class CloudFilesTests(unittest.TestCase):
 
         self.driver.connection.cdn_request = True
         self.assertEqual(
-             'https://cdn2.clouddrive.com/v1/MossoCloudFS',
+             'https://cdn.clouddrive.com/v1/MossoCloudFS',
              self.driver.connection.get_endpoint())
         self.driver.connection.cdn_request = False
 
@@ -723,7 +723,7 @@ class CloudFilesTests(unittest.TestCase):
                                     "/v1/MossoCloudFS/foo_bar_container/foo_bar_object")
         sig = hmac.new(b('foo'), b(hmac_body), sha1).hexdigest()
         ret = self.driver.ex_get_object_temp_url(obj, 'GET')
-        temp_url = 'https://storage101.%s1.clouddrive.com/v1/MossoCloudFS/foo_bar_container/foo_bar_object?temp_url_expires=60&temp_url_sig=%s'
% (self.datacenter, sig)
+        temp_url = 'https://storage4.%s1.clouddrive.com/v1/MossoCloudFS/foo_bar_container/foo_bar_object?temp_url_expires=60&temp_url_sig=%s'
% (self.datacenter, sig)
 
         self.assertEquals(''.join(sorted(ret)), ''.join(sorted(temp_url)))
 
@@ -761,9 +761,15 @@ class CloudFilesDeprecatedUKTests(CloudFilesTests):
 class CloudFilesMockHttp(StorageMockHttp, MockHttpTestCase):
 
     fixtures = StorageFileFixtures('cloudfiles')
-    auth_fixtures = OpenStackFixtures()
     base_headers = { 'content-type': 'application/json; charset=UTF-8'}
 
+    def _v2_0_tokens(self, method, url, body, headers):
+        headers = copy.deepcopy(self.base_headers)
+        body = self.fixtures.load('_v2_0__auth.json')
+        return (httplib.OK, body, headers,
+                httplib.responses[httplib.OK])
+
+
     # fake auth token response
     def _v1_0(self, method, url, body, headers):
         headers = copy.deepcopy(self.base_headers)
@@ -1004,10 +1010,6 @@ class CloudFilesMockHttp(StorageMockHttp, MockHttpTestCase):
 
         return (status_code, body, headers, httplib.responses[httplib.OK])
 
-    def _v1_1_auth(self, method, url, body, headers):
-        body = self.auth_fixtures.load('_v1_1__auth.json')
-        return (httplib.OK, body, {'content-type': 'application/json; charset=UTF-8'}, httplib.responses[httplib.OK])
-
 
 class CloudFilesMockRawResponse(MockRawResponse):
 


Mime
View raw message