You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2011/05/23 21:45:00 UTC

svn commit: r1126684 - /incubator/libcloud/trunk/test/compute/test_ec2.py

Author: tomaz
Date: Mon May 23 19:44:59 2011
New Revision: 1126684

URL: http://svn.apache.org/viewvc?rev=1126684&view=rev
Log:
Refactor EC2 test to inherit from LibcloudTestCase and use the new assertion method.

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

Modified: incubator/libcloud/trunk/test/compute/test_ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/compute/test_ec2.py?rev=1126684&r1=1126683&r2=1126684&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/compute/test_ec2.py (original)
+++ incubator/libcloud/trunk/test/compute/test_ec2.py Mon May 23 19:44:59 2011
@@ -21,15 +21,16 @@ from libcloud.compute.drivers.ec2 import
 from libcloud.compute.drivers.ec2 import EC2APNENodeDriver, IdempotentParamError
 from libcloud.compute.base import Node, NodeImage, NodeSize, NodeLocation
 
-from test import MockHttp
+from test import MockHttp, LibcloudTestCase
 from test.compute import TestCaseMixin
 from test.file_fixtures import ComputeFileFixtures
 
 from test.secrets import EC2_ACCESS_ID, EC2_SECRET
 
-class EC2Tests(unittest.TestCase, TestCaseMixin):
+class EC2Tests(LibcloudTestCase, TestCaseMixin):
 
     def setUp(self):
+        EC2MockHttp.test = self
         EC2NodeDriver.connectionCls.conn_classes = (None, EC2MockHttp)
         EC2MockHttp.use_param = 'Action'
         EC2MockHttp.type = None
@@ -335,6 +336,7 @@ class NimbusTests(EC2Tests):
     def test_list_nodes(self):
         # overridden from EC2Tests -- Nimbus doesn't support elastic IPs.
         node = self.driver.list_nodes()[0]
+        self.assertExecutedMethodCount(0)
         public_ips = node.public_ip
         self.assertEqual(node.id, 'i-4382922a')
         self.assertEqual(len(node.public_ip), 1)
@@ -344,8 +346,8 @@ class NimbusTests(EC2Tests):
        # Nimbus doesn't support creating tags so this one should be a
        # passthrough
        node = self.driver.list_nodes()[0]
-       EC2MockHttp.type = 'EX_CREATE_TAGS'
        self.driver.ex_create_tags(node=node, tags={'foo': 'bar'})
+       self.assertExecutedMethodCount(0)
 
 if __name__ == '__main__':
     sys.exit(unittest.main())