libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1071457 - /incubator/libcloud/trunk/test/test_ec2.py
Date Thu, 17 Feb 2011 00:26:58 GMT
Author: tomaz
Date: Thu Feb 17 00:26:58 2011
New Revision: 1071457

URL: http://svn.apache.org/viewvc?rev=1071457&view=rev
Log:
Make sure that an empty list is returned where there are no Elastic IPs
associated with a node.

Modified:
    incubator/libcloud/trunk/test/test_ec2.py

Modified: incubator/libcloud/trunk/test/test_ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_ec2.py?rev=1071457&r1=1071456&r2=1071457&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_ec2.py (original)
+++ incubator/libcloud/trunk/test/test_ec2.py Thu Feb 17 00:26:58 2011
@@ -166,6 +166,8 @@ class EC2Tests(unittest.TestCase, TestCa
         ip_addresses1 = self.driver.ex_describe_addresses_for_node(node1)
         node2 = Node('i-4382922b', None, None, None, None, self.driver)
         ip_addresses2 = sorted(self.driver.ex_describe_addresses_for_node(node2))
+        node3 = Node('i-4382922g', None, None, None, None, self.driver)
+        ip_addresses3 = sorted(self.driver.ex_describe_addresses_for_node(node3))
 
         self.assertEqual(len(ip_addresses1), 1)
         self.assertEqual(ip_addresses1[0], '1.2.3.4')
@@ -174,13 +176,21 @@ class EC2Tests(unittest.TestCase, TestCa
         self.assertEqual(ip_addresses2[0], '1.2.3.5')
         self.assertEqual(ip_addresses2[1], '1.2.3.6')
 
-    def test_ex_describe_addresses(self):
-        node = Node('i-4382922a', None, None, None, None, self.driver)
-        nodes_elastic_ips = self.driver.ex_describe_addresses([node])
+        self.assertEqual(len(ip_addresses3), 0)
 
-        self.assertEqual(len(nodes_elastic_ips), 1)
-        self.assertTrue(node.id in nodes_elastic_ips)
-        self.assertEqual(nodes_elastic_ips[node.id], ['1.2.3.4'])
+    def test_ex_describe_addresses(self):
+        node1 = Node('i-4382922a', None, None, None, None, self.driver)
+        node2 = Node('i-4382922g', None, None, None, None, self.driver)
+        nodes_elastic_ips1 = self.driver.ex_describe_addresses([node1])
+        nodes_elastic_ips2 = self.driver.ex_describe_addresses([node2])
+
+        self.assertEqual(len(nodes_elastic_ips1), 1)
+        self.assertTrue(node1.id in nodes_elastic_ips1)
+        self.assertEqual(nodes_elastic_ips1[node1.id], ['1.2.3.4'])
+
+        self.assertEqual(len(nodes_elastic_ips2), 1)
+        self.assertTrue(node2.id in nodes_elastic_ips2)
+        self.assertEqual(nodes_elastic_ips2[node2.id], [])
 
 
 class EC2MockHttp(MockHttp):



Mime
View raw message