libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1103368 - in /incubator/libcloud/trunk: libcloud/loadbalancer/drivers/rackspace.py test/loadbalancer/test_gogrid.py
Date Sun, 15 May 2011 13:14:47 GMT
Author: tomaz
Date: Sun May 15 13:14:47 2011
New Revision: 1103368

URL: http://svn.apache.org/viewvc?rev=1103368&view=rev
Log:
Fix a bug in the gogrid driver and add a test case for it.

Modified:
    incubator/libcloud/trunk/libcloud/loadbalancer/drivers/rackspace.py
    incubator/libcloud/trunk/test/loadbalancer/test_gogrid.py

Modified: incubator/libcloud/trunk/libcloud/loadbalancer/drivers/rackspace.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/loadbalancer/drivers/rackspace.py?rev=1103368&r1=1103367&r2=1103368&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/loadbalancer/drivers/rackspace.py (original)
+++ incubator/libcloud/trunk/libcloud/loadbalancer/drivers/rackspace.py Sun May 15 13:14:47
2011
@@ -90,6 +90,8 @@ class RackspaceLBDriver(Driver):
 
     def create_balancer(self, name, members, protocol='http',
                         port=80, algorithm=DEFAULT_ALGORITHM):
+        algorithm = self._algorithm_to_value(algorithm)
+
         balancer_object = {"loadBalancer":
                 {"name": name,
                     "port": port,

Modified: incubator/libcloud/trunk/test/loadbalancer/test_gogrid.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/loadbalancer/test_gogrid.py?rev=1103368&r1=1103367&r2=1103368&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/loadbalancer/test_gogrid.py (original)
+++ incubator/libcloud/trunk/test/loadbalancer/test_gogrid.py Sun May 15 13:14:47 2011
@@ -2,6 +2,7 @@ import httplib
 import os.path
 import sys
 import unittest
+from urlparse import urlparse, parse_qsl
 
 from libcloud.loadbalancer.base import LoadBalancer, Member, Algorithm
 from libcloud.loadbalancer.drivers.gogrid import GoGridLBDriver
@@ -83,7 +84,7 @@ class GoGridTests(unittest.TestCase):
 
         self.assertTrue(ret)
 
-class GoGridLBMockHttp(MockHttp):
+class GoGridLBMockHttp(MockHttp, unittest.TestCase):
     fixtures = LoadBalancerFileFixtures('gogrid')
 
     def _api_grid_loadbalancer_list(self, method, url, body, headers):
@@ -95,6 +96,9 @@ class GoGridLBMockHttp(MockHttp):
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _api_grid_loadbalancer_add(self, method, url, body, headers):
+        qs = dict(parse_qsl(urlparse(url).query))
+        self.assertEqual(qs['loadbalancer.type'], 'round balancer')
+
         body = self.fixtures.load('loadbalancer_add.json')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 



Mime
View raw message