libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [12/16] git commit: Add tests for the new region functionality in the ElasticHosts driver.
Date Thu, 17 Oct 2013 20:10:48 GMT
Add tests for the new region functionality in the ElasticHosts driver.


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

Branch: refs/heads/trunk
Commit: bba0c2c92f6dab7024f37c62a3db6fae019e0f30
Parents: e3e1713
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Thu Oct 17 21:09:27 2013 +0200
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Thu Oct 17 21:09:27 2013 +0200

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/bba0c2c9/libcloud/test/compute/test_elasticstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_elasticstack.py b/libcloud/test/compute/test_elasticstack.py
index 71577d1..fa9a387 100644
--- a/libcloud/test/compute/test_elasticstack.py
+++ b/libcloud/test/compute/test_elasticstack.py
@@ -152,6 +152,25 @@ class ElasticHostsTestCase(ElasticStackTestCase, unittest.TestCase):
                       i.id == '38df0986-4d85-4b76-b502-3878ffc80161'][0]
         super(ElasticHostsTestCase, self).setUp()
 
+    def test_multiple_drivers_with_different_regions(self):
+        driver1 = ElasticHosts('foo', 'bar', region='lon-p')
+        driver2 = ElasticHosts('foo', 'bar', region='sat-p')
+
+        self.assertTrue(driver1.connection.host.startswith('api-lon-p'))
+        self.assertTrue(driver2.connection.host.startswith('api-sat-p'))
+
+        driver1.list_nodes()
+        driver2.list_nodes()
+        driver1.list_nodes()
+
+        self.assertTrue(driver1.connection.host.startswith('api-lon-p'))
+        self.assertTrue(driver2.connection.host.startswith('api-sat-p'))
+
+    def test_invalid_region(self):
+        expected_msg = r'Invalid region.+'
+        self.assertRaisesRegexp(ValueError, expected_msg, ElasticHosts,
+                                'foo', 'bar', region='invalid')
+
 
 class SkaliCloudTestCase(ElasticStackTestCase, unittest.TestCase):
 


Mime
View raw message