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 2013/10/03 10:22:52 UTC

[1/3] git commit: Fix the test case, make sure it tests the correct branch.

Updated Branches:
  refs/heads/trunk 8c24cd627 -> 0d057251a


Fix the test case, make sure it tests the correct branch.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/530b2615
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/530b2615
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/530b2615

Branch: refs/heads/trunk
Commit: 530b2615a450be8b56bba8c2f95d0a39a4638c54
Parents: 8c24cd6
Author: Tomaz Muraus <to...@apache.org>
Authored: Wed Oct 2 21:05:50 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Oct 2 21:05:50 2013 +0100

----------------------------------------------------------------------
 libcloud/test/compute/test_openstack.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/530b2615/libcloud/test/compute/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py
index fe72c3e..30f78e3 100644
--- a/libcloud/test/compute/test_openstack.py
+++ b/libcloud/test/compute/test_openstack.py
@@ -912,7 +912,7 @@ class OpenStack_1_1_Tests(unittest.TestCase, TestCaseMixin):
         self.assertEqual(node.extra['key_name'], 'devstack')
 
     def test_create_node_with_ex_disk_config(self):
-        OpenStackMockHttp.type = 'EX_DISK_CONFIG'
+        OpenStack_1_1_MockHttp.type = 'EX_DISK_CONFIG'
         image = NodeImage(id=11, name='Ubuntu 8.10 (intrepid)', driver=self.driver)
         size = NodeSize(1, '256 slice', None, None, None, None, driver=self.driver)
         node = self.driver.create_node(name='racktest', image=image, size=size,
@@ -1579,7 +1579,9 @@ class OpenStack_1_1_Auth_2_0_Tests(OpenStack_1_1_Tests):
         self.driver_klass.connectionCls.conn_classes = \
                 (OpenStack_2_0_MockHttp, OpenStack_2_0_MockHttp)
         self.driver_klass.connectionCls.auth_url = "https://auth.api.example.com/v2.0/"
+        OpenStackMockHttp.type = None
         OpenStack_1_1_MockHttp.type = None
+        OpenStack_2_0_MockHttp.type = None
         self.driver = self.create_driver()
         # normally authentication happens lazily, but we force it here
         self.driver.connection._populate_hosts_and_request_paths()


[2/3] git commit: Set all MockHttpType.type attributes to None in setUp.

Posted by to...@apache.org.
Set all MockHttpType.type attributes to None in setUp.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/32f59e93
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/32f59e93
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/32f59e93

Branch: refs/heads/trunk
Commit: 32f59e93e7142a14678f3c47956059059aad8bf3
Parents: 530b261
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 3 09:17:52 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 3 09:17:52 2013 +0100

----------------------------------------------------------------------
 libcloud/test/compute/test_openstack.py | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/32f59e93/libcloud/test/compute/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py
index 30f78e3..f1a6385 100644
--- a/libcloud/test/compute/test_openstack.py
+++ b/libcloud/test/compute/test_openstack.py
@@ -719,6 +719,8 @@ class OpenStack_1_1_Tests(unittest.TestCase, TestCaseMixin):
     def setUp(self):
         self.driver_klass.connectionCls.conn_classes = (OpenStack_2_0_MockHttp, OpenStack_2_0_MockHttp)
         self.driver_klass.connectionCls.auth_url = "https://auth.api.example.com/v2.0/"
+        OpenStackMockHttp.type = None
+        OpenStack_1_1_MockHttp.type = None
         OpenStack_2_0_MockHttp.type = None
         self.driver = self.create_driver()
 


[3/3] git commit: Refactor Rackspace tests and remove duplicated code.

Posted by to...@apache.org.
Refactor Rackspace tests and remove duplicated code.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/0d057251
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/0d057251
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/0d057251

Branch: refs/heads/trunk
Commit: 0d057251a8c934a016b7186dfbae33dc4609ffa4
Parents: 32f59e9
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 3 09:18:08 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 3 09:20:12 2013 +0100

----------------------------------------------------------------------
 libcloud/test/compute/test_rackspace.py | 68 +++++++++-------------------
 1 file changed, 22 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/0d057251/libcloud/test/compute/test_rackspace.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_rackspace.py b/libcloud/test/compute/test_rackspace.py
index c232f05..601a529 100644
--- a/libcloud/test/compute/test_rackspace.py
+++ b/libcloud/test/compute/test_rackspace.py
@@ -84,7 +84,7 @@ class RackspaceNovaMockHttp(OpenStack_1_1_MockHttp):
             method = methods1[name]
             new_name = name.replace('_v1_1_slug_', '_v2_1337_')
             setattr(self, new_name, method_type(method, self,
-                RackspaceNovaMockHttp))
+                                                RackspaceNovaMockHttp))
 
 
 class RackspaceNovaLonMockHttp(RackspaceNovaMockHttp):
@@ -95,57 +95,45 @@ class RackspaceNovaLonMockHttp(RackspaceNovaMockHttp):
                 httplib.responses[httplib.OK])
 
 
+class BaseRackspaceNovaTestCase(OpenStack_1_1_Tests):
+    conn_classes = (RackspaceNovaMockHttp, RackspaceNovaMockHttp)
+    auth_url = 'https://auth.api.example.com/v2.0/'
 
-class RackspaceNovaDfwTests(OpenStack_1_1_Tests):
-
-    driver_klass = RackspaceNodeDriver
-    driver_type = RackspaceNodeDriver
-    driver_args = RACKSPACE_NOVA_PARAMS
-    driver_kwargs = {'region': 'dfw'}
-
-    @classmethod
     def create_driver(self):
         return self.driver_type(*self.driver_args, **self.driver_kwargs)
 
     def setUp(self):
-        self.driver_klass.connectionCls.conn_classes = (RackspaceNovaMockHttp,
-                                                        RackspaceNovaMockHttp)
-        self.driver_klass.connectionCls.auth_url = \
-                'https://auth.api.example.com/v2.0/'
+        self.driver_klass.connectionCls.conn_classes = self.conn_classes
+        self.driver_klass.connectionCls.auth_url = self.auth_url
+        self.conn_classes[0].type = None
+        self.conn_classes[1].type = None
         self.driver = self.create_driver()
         # normally authentication happens lazily, but we force it here
         self.driver.connection._populate_hosts_and_request_paths()
         clear_pricing_data()
         self.node = self.driver.list_nodes()[1]
 
+
+class RackspaceNovaDfwTests(BaseRackspaceNovaTestCase):
+
+    driver_klass = RackspaceNodeDriver
+    driver_type = RackspaceNodeDriver
+    driver_args = RACKSPACE_NOVA_PARAMS
+    driver_kwargs = {'region': 'dfw'}
+
     def test_service_catalog(self):
         self.assertEqual(
-                'https://dfw.servers.api.rackspacecloud.com/v2/1337',
-                self.driver.connection.get_endpoint())
+            'https://dfw.servers.api.rackspacecloud.com/v2/1337',
+            self.driver.connection.get_endpoint())
 
 
-class RackspaceNovaOrdTests(OpenStack_1_1_Tests):
+class RackspaceNovaOrdTests(BaseRackspaceNovaTestCase):
 
     driver_klass = RackspaceNodeDriver
     driver_type = RackspaceNodeDriver
     driver_args = RACKSPACE_NOVA_PARAMS
     driver_kwargs = {'region': 'ord'}
 
-    @classmethod
-    def create_driver(self):
-        return self.driver_type(*self.driver_args, **self.driver_kwargs)
-
-    def setUp(self):
-        self.driver_klass.connectionCls.conn_classes = (RackspaceNovaMockHttp,
-                                                        RackspaceNovaMockHttp)
-        self.driver_klass.connectionCls.auth_url = \
-                'https://auth.api.example.com/v2.0/'
-        self.driver = self.create_driver()
-        # normally authentication happens lazily, but we force it here
-        self.driver.connection._populate_hosts_and_request_paths()
-        clear_pricing_data()
-        self.node = self.driver.list_nodes()[1]
-
     def test_list_sizes_pricing(self):
         sizes = self.driver.list_sizes()
 
@@ -158,27 +146,15 @@ class RackspaceNovaOrdTests(OpenStack_1_1_Tests):
                          self.driver.connection.get_endpoint())
 
 
-class RackspaceNovaLonTests(OpenStack_1_1_Tests):
+class RackspaceNovaLonTests(BaseRackspaceNovaTestCase):
 
     driver_klass = RackspaceNodeDriver
     driver_type = RackspaceNodeDriver
     driver_args = RACKSPACE_NOVA_PARAMS
     driver_kwargs = {'region': 'lon'}
 
-    @classmethod
-    def create_driver(self):
-        return self.driver_type(*self.driver_args, **self.driver_kwargs)
-
-    def setUp(self):
-        self.driver_klass.connectionCls.conn_classes = \
-                (RackspaceNovaLonMockHttp, RackspaceNovaLonMockHttp)
-        self.driver_klass.connectionCls.auth_url = \
-                'https://lon.auth.api.example.com/v2.0/'
-        self.driver = self.create_driver()
-        # normally authentication happens lazily, but we force it here
-        self.driver.connection._populate_hosts_and_request_paths()
-        clear_pricing_data()
-        self.node = self.driver.list_nodes()[1]
+    conn_classes = (RackspaceNovaLonMockHttp, RackspaceNovaLonMockHttp)
+    auth_url = 'https://lon.auth.api.example.com/v2.0/'
 
     def test_list_sizes_pricing(self):
         sizes = self.driver.list_sizes()