Updated Branches: refs/heads/trunk b651f6de1 -> e72a88b26
Add a test for CloudStack compute driver which verifies that driver throws an exception if user instantiates the driver correctly, but doesn't provider host and path argument. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b7252c5b Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b7252c5b Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b7252c5b Branch: refs/heads/trunk Commit: b7252c5b1753dc3df83723799d5f0f47eaedb401 Parents: b651f6d Author: Tomaz Muraus <[email protected]> Authored: Sat Aug 17 16:45:55 2013 +0200 Committer: Tomaz Muraus <[email protected]> Committed: Sat Aug 17 16:45:55 2013 +0200 ---------------------------------------------------------------------- libcloud/test/compute/test_cloudstack.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/b7252c5b/libcloud/test/compute/test_cloudstack.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_cloudstack.py b/libcloud/test/compute/test_cloudstack.py index 31562ff..2f27539 100644 --- a/libcloud/test/compute/test_cloudstack.py +++ b/libcloud/test/compute/test_cloudstack.py @@ -27,7 +27,8 @@ except ImportError: import json from libcloud.compute.drivers.cloudstack import CloudStackNodeDriver -from libcloud.compute.types import DeploymentError, LibcloudError +from libcloud.compute.types import DeploymentError, LibcloudError, Provider +from libcloud.compute.providers import get_driver from libcloud.compute.base import Node, NodeImage, NodeSize, NodeLocation from libcloud.test import unittest @@ -48,6 +49,19 @@ class CloudStackNodeDriverTest(unittest.TestCase, TestCaseMixin): CloudStackMockHttp.fixture_tag = 'default' self.driver.connection.poll_interval = 0.0 + def test_user_must_provide_host_and_path(self): + expected_msg = 'When instantiating CloudStack driver directly ' + \ + 'you also need to provide host and path argument' + cls = get_driver(Provider.CLOUDSTACK) + + self.assertRaisesRegexp(Exception, expected_msg, cls, + 'key', 'secret') + + try: + cls('key', 'secret', True, 'localhost', '/path') + except Exception: + self.fail('host and path provided but driver raised an exception') + def test_create_node_immediate_failure(self): size = self.driver.list_sizes()[0] image = self.driver.list_images()[0]
