libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1103371 - /incubator/libcloud/trunk/test/loadbalancer/test_rackspace.py
Date Sun, 15 May 2011 13:20:08 GMT
Author: tomaz
Date: Sun May 15 13:20:08 2011
New Revision: 1103371

URL: http://svn.apache.org/viewvc?rev=1103371&view=rev
Log:
Make sure the correct parameters are sent when creating a load balancer in the
Rackspace driver.

Modified:
    incubator/libcloud/trunk/test/loadbalancer/test_rackspace.py

Modified: incubator/libcloud/trunk/test/loadbalancer/test_rackspace.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/loadbalancer/test_rackspace.py?rev=1103371&r1=1103370&r2=1103371&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/loadbalancer/test_rackspace.py (original)
+++ incubator/libcloud/trunk/test/loadbalancer/test_rackspace.py Sun May 15 13:20:08 2011
@@ -2,6 +2,12 @@ import httplib
 import os.path
 import sys
 import unittest
+from urlparse import parse_qsl
+
+try:
+    import json
+except ImportError:
+    import simplejson as json
 
 from libcloud.loadbalancer.base import Member, Algorithm
 from libcloud.loadbalancer.drivers.rackspace import RackspaceLBDriver
@@ -78,7 +84,7 @@ class RackspaceLBTests(unittest.TestCase
 
         self.assertTrue(ret)
 
-class RackspaceLBMockHttp(MockHttp):
+class RackspaceLBMockHttp(MockHttp, unittest.TestCase):
     fixtures = LoadBalancerFileFixtures('rackspace')
 
     def _v1_0(self, method, url, body, headers):
@@ -99,6 +105,10 @@ class RackspaceLBMockHttp(MockHttp):
             body = self.fixtures.load('v1_slug_loadbalancers.json')
             return (httplib.OK, body, {}, httplib.responses[httplib.OK])
         elif method == "POST":
+            body_json = json.loads(body)
+            self.assertEqual(body_json['loadBalancer']['protocol'], 'HTTP')
+            self.assertEqual(body_json['loadBalancer']['algorithm'], 'ROUND_ROBIN')
+
             body = self.fixtures.load('v1_slug_loadbalancers_post.json')
             return (httplib.ACCEPTED, body, {},
                     httplib.responses[httplib.ACCEPTED])



Mime
View raw message