Update affected Rackspace LB tests.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3c7a7f3f Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3c7a7f3f Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3c7a7f3f Branch: refs/heads/make_rackspace_drivers_multi_datacenter_aware Commit: 3c7a7f3f6b481d56886e9f928264c560783ff80a Parents: 7efe251 Author: Tomaz Muraus <[email protected]> Authored: Sun Jun 23 09:04:46 2013 +0200 Committer: Tomaz Muraus <[email protected]> Committed: Sun Jun 23 09:04:46 2013 +0200 ---------------------------------------------------------------------- .../dns/fixtures/rackspace/_v2_0__auth.json | 23 ++- .../fixtures/rackspace/_v2_0__auth.json | 154 +++++++++++++++++++ libcloud/test/loadbalancer/test_rackspace.py | 148 ++++++++---------- 3 files changed, 237 insertions(+), 88 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/3c7a7f3f/libcloud/test/dns/fixtures/rackspace/_v2_0__auth.json ---------------------------------------------------------------------- diff --git a/libcloud/test/dns/fixtures/rackspace/_v2_0__auth.json b/libcloud/test/dns/fixtures/rackspace/_v2_0__auth.json index 5f68001..ae33125 100644 --- a/libcloud/test/dns/fixtures/rackspace/_v2_0__auth.json +++ b/libcloud/test/dns/fixtures/rackspace/_v2_0__auth.json @@ -121,7 +121,28 @@ } ], "type": "rax:dns" - } + }, + { + "name": "cloudLoadBalancers", + "endpoints": [ + { + "region": "SYD", + "tenantId": "11111", + "publicURL": "https://syd.loadbalancers.api.rackspacecloud.com/v1.0/11111" + }, + { + "region": "DFW", + "tenantId": "11111", + "publicURL": "https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/11111" + }, + { + "region": "ORD", + "tenantId": "11111", + "publicURL": "https://ord.loadbalancers.api.rackspacecloud.com/v1.0/11111" + } + ], + "type": "rax:load-balancer" + }, ], "user": { "id": "7", http://git-wip-us.apache.org/repos/asf/libcloud/blob/3c7a7f3f/libcloud/test/loadbalancer/fixtures/rackspace/_v2_0__auth.json ---------------------------------------------------------------------- diff --git a/libcloud/test/loadbalancer/fixtures/rackspace/_v2_0__auth.json b/libcloud/test/loadbalancer/fixtures/rackspace/_v2_0__auth.json new file mode 100644 index 0000000..9fc3835 --- /dev/null +++ b/libcloud/test/loadbalancer/fixtures/rackspace/_v2_0__auth.json @@ -0,0 +1,154 @@ +{ + "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" + }, + { + "name": "cloudLoadBalancers", + "endpoints": [ + { + "region": "SYD", + "tenantId": "11111", + "publicURL": "https://syd.loadbalancers.api.rackspacecloud.com/v1.0/11111" + }, + { + "region": "DFW", + "tenantId": "11111", + "publicURL": "https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/11111" + }, + { + "region": "ORD", + "tenantId": "11111", + "publicURL": "https://ord.loadbalancers.api.rackspacecloud.com/v1.0/11111" + }, + { + "region": "LON", + "tenantId": "11111", + "publicURL": "https://lon.loadbalancers.api.rackspacecloud.com/v1.0/11111" + } + ], + "type": "rax:load-balancer" + } + ], + "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/3c7a7f3f/libcloud/test/loadbalancer/test_rackspace.py ---------------------------------------------------------------------- diff --git a/libcloud/test/loadbalancer/test_rackspace.py b/libcloud/test/loadbalancer/test_rackspace.py index fda5134..9a04b0e 100644 --- a/libcloud/test/loadbalancer/test_rackspace.py +++ b/libcloud/test/loadbalancer/test_rackspace.py @@ -906,20 +906,17 @@ class RackspaceLBMockHttp(MockHttpTestCase): fixtures = LoadBalancerFileFixtures('rackspace') auth_fixtures = OpenStackFixtures() - def _v1_0(self, method, url, body, headers): - headers = {'x-server-management-url': 'https://servers.api.rackspacecloud.com/v1.0/slug', - 'x-auth-token': 'FE011C19-CF86-4F87-BE5D-9229145D7A06', - 'x-cdn-management-url': 'https://cdn.clouddrive.com/v1/MossoCloudFS_FE011C19-CF86-4F87-BE5D-9229145D7A06', - 'x-storage-token': 'FE011C19-CF86-4F87-BE5D-9229145D7A06', - 'x-storage-url': 'https://storage4.clouddrive.com/v1/MossoCloudFS_FE011C19-CF86-4F87-BE5D-9229145D7A06'} - return (httplib.NO_CONTENT, "", headers, httplib.responses[httplib.NO_CONTENT]) - - def _v1_0_slug_loadbalancers_protocols(self, method, url, body, headers): + def _v2_0_tokens(self, method, url, body, headers): + body = self.fixtures.load('_v2_0__auth.json') + return (httplib.OK, body, headers, + httplib.responses[httplib.OK]) + + def _v1_0_11111_loadbalancers_protocols(self, method, url, body, headers): body = self.fixtures.load('v1_slug_loadbalancers_protocols.json') return (httplib.ACCEPTED, body, {}, httplib.responses[httplib.ACCEPTED]) - def _v1_0_slug_loadbalancers_algorithms(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_algorithms(self, method, url, body, headers): if method == "GET": body = self.fixtures.load('v1_slug_loadbalancers_algorithms.json') return (httplib.ACCEPTED, body, {}, @@ -927,7 +924,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers(self, method, url, body, headers): + def _v1_0_11111_loadbalancers(self, method, url, body, headers): if method == "GET": body = self.fixtures.load('v1_slug_loadbalancers.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) @@ -960,24 +957,24 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_EX_MEMBER_ADDRESS(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_EX_MEMBER_ADDRESS(self, method, url, body, headers): body = self.fixtures.load('v1_slug_loadbalancers_nodeaddress.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - def _v1_0_slug_loadbalancers_8155(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8155(self, method, url, body, headers): if method == "DELETE": return (httplib.ACCEPTED, "", {}, httplib.responses[httplib.ACCEPTED]) raise NotImplementedError - def _v1_0_slug_loadbalancers_8290(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8290(self, method, url, body, headers): if method == "GET": body = self.fixtures.load('v1_slug_loadbalancers_8290.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_8290_nodes(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8290_nodes(self, method, url, body, headers): if method == "GET": body = self.fixtures.load('v1_slug_loadbalancers_8290_nodes.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) @@ -1002,14 +999,14 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_8291(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8291(self, method, url, body, headers): if method == "GET": body = self.fixtures.load('v1_slug_loadbalancers_8291.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_8291_nodes(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8291_nodes(self, method, url, body, headers): if method == "POST": json_body = json.loads(body) json_node = json_body['nodes'][0] @@ -1020,14 +1017,14 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_8292(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8292(self, method, url, body, headers): if method == "GET": body = self.fixtures.load('v1_slug_loadbalancers_8292.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_8292_nodes(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8292_nodes(self, method, url, body, headers): if method == "POST": json_body = json.loads(body) json_node_1 = json_body['nodes'][0] @@ -1040,7 +1037,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_8290_nodes_30944(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8290_nodes_30944(self, method, url, body, headers): if method == "PUT": json_body = json.loads(body) self.assertEqual('ENABLED', json_body['condition']) @@ -1051,19 +1048,19 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_8290_healthmonitor(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8290_healthmonitor(self, method, url, body, headers): if method == "DELETE": return (httplib.ACCEPTED, '', {}, httplib.responses[httplib.ACCEPTED]) raise NotImplementedError - def _v1_0_slug_loadbalancers_8290_connectionthrottle(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8290_connectionthrottle(self, method, url, body, headers): if method == 'DELETE': return (httplib.ACCEPTED, '', {}, httplib.responses[httplib.ACCEPTED]) raise NotImplementedError - def _v1_0_slug_loadbalancers_8290_connectionlogging(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8290_connectionlogging(self, method, url, body, headers): # Connection Logging uses a PUT to disable connection logging if method == 'PUT': json_body = json.loads(body) @@ -1074,13 +1071,13 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_8290_sessionpersistence(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8290_sessionpersistence(self, method, url, body, headers): if method == 'DELETE': return (httplib.ACCEPTED, '', {}, httplib.responses[httplib.ACCEPTED]) raise NotImplementedError - def _v1_0_slug_loadbalancers_8290_errorpage(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_8290_errorpage(self, method, url, body, headers): if method == 'GET': body = self.fixtures.load('v1_slug_loadbalancers_8290_errorpage.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) @@ -1093,70 +1090,70 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_18940(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_18940(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_18940_ex_public_ips.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_18945(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_18945(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_18945_ex_public_ips.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_18940_errorpage(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_18940_errorpage(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_18940_errorpage.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_18940_accesslist(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_18940_accesslist(self, method, url, body, headers): if method == 'GET': body = self.fixtures.load('v1_slug_loadbalancers_18940_accesslist.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_18941(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_18941(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_18941_ex_private_ips.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_94692(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94692(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_94692_weighted_round_robin.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_94693(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94693(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_94693_weighted_least_connections.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_94694(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94694(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_94694_unknown_algorithm.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_94695(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94695(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_94695_full_details.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_94695_healthmonitor(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94695_healthmonitor(self, method, url, body, headers): if method == 'PUT': json_body = json.loads(body) @@ -1169,7 +1166,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_94695_connectionthrottle(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94695_connectionthrottle(self, method, url, body, headers): if method == 'PUT': json_body = json.loads(body) @@ -1182,7 +1179,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_94695_connectionlogging(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94695_connectionlogging(self, method, url, body, headers): if method == 'PUT': json_body = json.loads(body) @@ -1192,7 +1189,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_94695_sessionpersistence(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94695_sessionpersistence(self, method, url, body, headers): if method == 'PUT': json_body = json.loads(body) @@ -1203,7 +1200,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_94695_errorpage(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94695_errorpage(self, method, url, body, headers): if method == 'GET': body = self.fixtures.load("error_page_default.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) @@ -1212,14 +1209,14 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_94696(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94696(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_94696_http_health_monitor.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_94696_healthmonitor(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94696_healthmonitor(self, method, url, body, headers): if method == 'PUT': json_body = json.loads(body) @@ -1235,21 +1232,21 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_94697(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94697(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_94697_https_health_monitor.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_94698(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94698(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_94698_with_access_list.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_94698_accesslist(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94698_accesslist(self, method, url, body, headers): if method == 'GET': body = self.fixtures.load('v1_slug_loadbalancers_94698_accesslist.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) @@ -1263,7 +1260,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_94699(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94699(self, method, url, body, headers): if method == 'GET': # Use the same fixture for batch deletes as for single deletes body = self.fixtures.load('v1_slug_loadbalancers_94698_with_access_list.json') @@ -1275,7 +1272,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_94699_accesslist(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94699_accesslist(self, method, url, body, headers): if method == 'DELETE': fixture = 'v1_slug_loadbalancers_94698_with_access_list.json' fixture_json = json.loads(self.fixtures.load(fixture)) @@ -1300,20 +1297,20 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_94698_accesslist_1007(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94698_accesslist_1007(self, method, url, body, headers): if method == 'DELETE': return (httplib.ACCEPTED, '', {}, httplib.responses[httplib.ACCEPTED]) raise NotImplementedError - def _v1_0_slug_loadbalancers_94700(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94700(self, method, url, body, headers): if method == "GET": body = self.fixtures.load("v1_slug_loadbalancers_94700_http_health_monitor_no_body_regex.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_94700_healthmonitor(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_94700_healthmonitor(self, method, url, body, headers): if method == 'PUT': json_body = json.loads(body) @@ -1329,7 +1326,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): raise NotImplementedError - def _v1_0_slug_loadbalancers_3130(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_3130(self, method, url, body, headers): """ update_balancer(b, protocol='HTTPS'), then get_balancer('3130') """ if method == "PUT": self.assertEqual(json.loads(body), {'protocol': 'HTTPS'}) @@ -1341,7 +1338,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): return (httplib.OK, json.dumps(response_body), {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_3131(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_3131(self, method, url, body, headers): """ update_balancer(b, port=443), then get_balancer('3131') """ if method == "PUT": self.assertEqual(json.loads(body), {'port': 1337}) @@ -1353,7 +1350,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): return (httplib.OK, json.dumps(response_body), {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_3132(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_3132(self, method, url, body, headers): """ update_balancer(b, name='new_lb_name'), then get_balancer('3132') """ if method == "PUT": self.assertEqual(json.loads(body), {'name': 'new_lb_name'}) @@ -1365,7 +1362,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): return (httplib.OK, json.dumps(response_body), {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_3133(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_3133(self, method, url, body, headers): """ update_balancer(b, algorithm='ROUND_ROBIN'), then get_balancer('3133') """ if method == "PUT": self.assertEqual(json.loads(body), {'algorithm': 'ROUND_ROBIN'}) @@ -1377,13 +1374,13 @@ class RackspaceLBMockHttp(MockHttpTestCase): return (httplib.OK, json.dumps(response_body), {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_3134(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_3134(self, method, url, body, headers): """ update.balancer(b, algorithm='HAVE_MERCY_ON_OUR_SERVERS') """ if method == "PUT": return (httplib.BAD_REQUEST, "", {}, httplib.responses[httplib.BAD_REQUEST]) raise NotImplementedError - def _v1_0_slug_loadbalancers_3135(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_3135(self, method, url, body, headers): """ update_balancer(b, protocol='IMAPv3'), then get_balancer('3135') """ if method == "PUT": self.assertEqual(json.loads(body), {'protocol': 'IMAPv2'}) @@ -1395,7 +1392,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): return (httplib.OK, json.dumps(response_body), {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_3136(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_3136(self, method, url, body, headers): """ update_balancer(b, protocol='IMAPv3'), then get_balancer('3136') """ if method == "PUT": self.assertEqual(json.loads(body), {'protocol': 'IMAPv3'}) @@ -1407,7 +1404,7 @@ class RackspaceLBMockHttp(MockHttpTestCase): return (httplib.OK, json.dumps(response_body), {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_3137(self, method, url, body, headers): + def _v1_0_11111_loadbalancers_3137(self, method, url, body, headers): """ update_balancer(b, protocol='IMAPv3'), then get_balancer('3137') """ if method == "PUT": self.assertEqual(json.loads(body), {'protocol': 'IMAPv4'}) @@ -1419,40 +1416,24 @@ class RackspaceLBMockHttp(MockHttpTestCase): return (httplib.OK, json.dumps(response_body), {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_0_slug_loadbalancers_8290_usage_current(self, method, url, body, + def _v1_0_11111_loadbalancers_8290_usage_current(self, method, url, body, headers): if method == 'GET': - body = self.fixtures.load('v1_0_slug_loadbalancers_8290_usage_current.json') + body = self.fixtures.load('v1_0_11111_loadbalancers_8290_usage_current.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) raise NotImplementedError - def _v1_1_auth(self, method, url, body, headers): - headers = {'content-type': 'application/json; charset=UTF-8'} - body = self.auth_fixtures.load('_v1_1__auth.json') - return (httplib.OK, body, headers, httplib.responses[httplib.OK]) - - def _v2_0_tokens(self, method, url, body, headers): - body = self.fixtures.load('auth_2_0.json') - headers = { - 'content-type': 'application/json' - } - return (httplib.OK, body, headers, - httplib.responses[httplib.OK]) - class RackspaceLBWithVIPMockHttp(MockHttpTestCase): fixtures = LoadBalancerFileFixtures('rackspace') auth_fixtures = OpenStackFixtures() - def _v1_0(self, method, url, body, headers): - headers = {'x-server-management-url': 'https://servers.api.rackspacecloud.com/v1.0/slug', - 'x-auth-token': 'FE011C19-CF86-4F87-BE5D-9229145D7A06', - 'x-cdn-management-url': 'https://cdn.clouddrive.com/v1/MossoCloudFS_FE011C19-CF86-4F87-BE5D-9229145D7A06', - 'x-storage-token': 'FE011C19-CF86-4F87-BE5D-9229145D7A06', - 'x-storage-url': 'https://storage4.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.fixtures.load('_v2_0__auth.json') + return (httplib.OK, body, headers, + httplib.responses[httplib.OK]) - def _v1_0_slug_loadbalancers(self, method, url, body, headers): + def _v1_0_11111_loadbalancers(self, method, url, body, headers): if method == "GET": body = self.fixtures.load('v1_slug_loadbalancers.json') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) @@ -1473,13 +1454,6 @@ class RackspaceLBWithVIPMockHttp(MockHttpTestCase): body = self.auth_fixtures.load('_v1_1__auth.json') return (httplib.OK, body, headers, httplib.responses[httplib.OK]) - def _v2_0_tokens(self, method, url, body, headers): - body = self.fixtures.load('auth_2_0.json') - headers = { - 'content-type': 'application/json' - } - return (httplib.OK, body, headers, - httplib.responses[httplib.OK]) if __name__ == "__main__": sys.exit(unittest.main())
