You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by je...@apache.org on 2010/08/06 00:48:47 UTC
svn commit: r982817 - in /incubator/libcloud/trunk: libcloud/base.py
test/test_ecp.py test/test_gogrid.py test/test_slicehost.py
test/test_softlayer.py test/test_vpsnet.py
Author: jed
Date: Thu Aug 5 22:48:46 2010
New Revision: 982817
URL: http://svn.apache.org/viewvc?rev=982817&view=rev
Log:
Force all IDs to be strings (LIBCLOUD-40)
Address inconsistency in the library about the type of an ID, whether
it be a Node's, Image's, or so on. All IDs become strings
automatically now, and update the tests to reflect that.
Modified:
incubator/libcloud/trunk/libcloud/base.py
incubator/libcloud/trunk/test/test_ecp.py
incubator/libcloud/trunk/test/test_gogrid.py
incubator/libcloud/trunk/test/test_slicehost.py
incubator/libcloud/trunk/test/test_softlayer.py
incubator/libcloud/trunk/test/test_vpsnet.py
Modified: incubator/libcloud/trunk/libcloud/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/base.py?rev=982817&r1=982816&r2=982817&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/base.py (original)
+++ incubator/libcloud/trunk/libcloud/base.py Thu Aug 5 22:48:46 2010
@@ -36,7 +36,7 @@ class Node(object):
def __init__(self, id, name, state, public_ip, private_ip,
driver, extra=None):
- self.id = id
+ self.id = str(id)
self.name = name
self.state = state
self.public_ip = public_ip
@@ -79,7 +79,7 @@ class NodeSize(object):
"""
def __init__(self, id, name, ram, disk, bandwidth, price, driver):
- self.id = id
+ self.id = str(id)
self.name = name
self.ram = ram
self.disk = disk
@@ -99,7 +99,7 @@ class NodeImage(object):
"""
def __init__(self, id, name, driver, extra=None):
- self.id = id
+ self.id = str(id)
self.name = name
self.driver = driver
if not extra:
@@ -116,7 +116,7 @@ class NodeLocation(object):
"""
def __init__(self, id, name, country, driver):
- self.id = id
+ self.id = str(id)
self.name = name
self.country = country
self.driver = driver
Modified: incubator/libcloud/trunk/test/test_ecp.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_ecp.py?rev=982817&r1=982816&r2=982817&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_ecp.py (original)
+++ incubator/libcloud/trunk/test/test_ecp.py Thu Aug 5 22:48:46 2010
@@ -36,7 +36,7 @@ class ECPTests(unittest.TestCase, TestCa
nodes = self.driver.list_nodes()
self.assertEqual(len(nodes),2)
node = nodes[0]
- self.assertEqual(node.id, 1)
+ self.assertEqual(node.id, '1')
self.assertEqual(node.name, 'dummy-1')
self.assertEqual(node.public_ip[0], "42.78.124.75")
self.assertEqual(node.state, NodeState.RUNNING)
Modified: incubator/libcloud/trunk/test/test_gogrid.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_gogrid.py?rev=982817&r1=982816&r2=982817&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_gogrid.py (original)
+++ incubator/libcloud/trunk/test/test_gogrid.py Thu Aug 5 22:48:46 2010
@@ -46,7 +46,7 @@ class GoGridTests(unittest.TestCase, Tes
def test_list_nodes(self):
node = self.driver.list_nodes()[0]
- self.assertEqual(node.id, 90967)
+ self.assertEqual(node.id, '90967')
self.assertEqual(node.extra['password'], 'bebebe')
def test_reboot_node(self):
@@ -64,7 +64,7 @@ class GoGridTests(unittest.TestCase, Tes
image = images[0]
self.assertEqual(len(images), 4)
self.assertEqual(image.name, 'CentOS 5.3 (32-bit) w/ None')
- self.assertEqual(image.id, 1531)
+ self.assertEqual(image.id, '1531')
class GoGridMockHttp(MockHttp):
Modified: incubator/libcloud/trunk/test/test_slicehost.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_slicehost.py?rev=982817&r1=982816&r2=982817&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_slicehost.py (original)
+++ incubator/libcloud/trunk/test/test_slicehost.py Thu Aug 5 22:48:46 2010
@@ -61,7 +61,7 @@ class SlicehostTest(unittest.TestCase, T
self.assertEqual(len(ret), 11)
image = ret[0]
self.assertEqual(image.name, 'CentOS 5.2')
- self.assertEqual(image.id, 2)
+ self.assertEqual(image.id, '2')
def test_reboot_node(self):
node = Node(id=1, name=None, state=None, public_ip=None, private_ip=None,
Modified: incubator/libcloud/trunk/test/test_softlayer.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_softlayer.py?rev=982817&r1=982816&r2=982817&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_softlayer.py (original)
+++ incubator/libcloud/trunk/test/test_softlayer.py Thu Aug 5 22:48:46 2010
@@ -56,12 +56,12 @@ class SoftLayerTests(unittest.TestCase):
locations = self.driver.list_locations()
seattle = (l for l in locations if l.name == 'sea01').next()
self.assertEqual(seattle.country, 'US')
- self.assertEqual(seattle.id, 18171)
+ self.assertEqual(seattle.id, '18171')
def test_list_images(self):
images = self.driver.list_images()
image = images[0]
- self.assertEqual(image.id, 1684)
+ self.assertEqual(image.id, '1684')
def test_list_sizes(self):
sizes = self.driver.list_sizes()
Modified: incubator/libcloud/trunk/test/test_vpsnet.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_vpsnet.py?rev=982817&r1=982816&r2=982817&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_vpsnet.py (original)
+++ incubator/libcloud/trunk/test/test_vpsnet.py Thu Aug 5 22:48:46 2010
@@ -42,7 +42,7 @@ class VPSNetTests(unittest.TestCase, Tes
def test_list_nodes(self):
VPSNetMockHttp.type = 'virtual_machines'
node = self.driver.list_nodes()[0]
- self.assertEqual(node.id, 1384)
+ self.assertEqual(node.id, '1384')
self.assertEqual(node.state, NodeState.RUNNING)
def test_reboot_node(self):
@@ -65,14 +65,14 @@ class VPSNetTests(unittest.TestCase, Tes
def test_list_images(self):
VPSNetMockHttp.type = 'templates'
ret = self.driver.list_images()
- self.assertEqual(ret[0].id, 9)
- self.assertEqual(ret[-1].id, 160)
+ self.assertEqual(ret[0].id, '9')
+ self.assertEqual(ret[-1].id, '160')
def test_list_sizes(self):
VPSNetMockHttp.type = 'sizes'
ret = self.driver.list_sizes()
self.assertEqual(len(ret), 1)
- self.assertEqual(ret[0].id, 1)
+ self.assertEqual(ret[0].id, '1')
self.assertEqual(ret[0].name, '1 Node')
def test_destroy_node_response(self):