Add assertion for user data Closes #797
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a4a58f9c Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a4a58f9c Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a4a58f9c Branch: refs/heads/trunk Commit: a4a58f9c5b8fa4e1a6cd2d37a0356ba23d05540a Parents: 8a629fe Author: Stefan Friesel <[email protected]> Authored: Mon Jun 6 13:20:02 2016 +0200 Committer: Anthony Shaw <[email protected]> Committed: Fri Jun 17 08:20:32 2016 +1000 ---------------------------------------------------------------------- libcloud/test/__init__.py | 1 + libcloud/test/compute/test_cloudstack.py | 6 ++++++ 2 files changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/a4a58f9c/libcloud/test/__init__.py ---------------------------------------------------------------------- diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py index 76f5b0c..a32ab1a 100644 --- a/libcloud/test/__init__.py +++ b/libcloud/test/__init__.py @@ -259,6 +259,7 @@ class MockHttpTestCase(MockHttp, unittest.TestCase): self.assertDictEqual(params, expected_params) else: for key, value in expected_params.items(): + self.assertIn(key, params) self.assertEqual(params[key], value) http://git-wip-us.apache.org/repos/asf/libcloud/blob/a4a58f9c/libcloud/test/compute/test_cloudstack.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_cloudstack.py b/libcloud/test/compute/test_cloudstack.py index 2faeb21..c347901 100644 --- a/libcloud/test/compute/test_cloudstack.py +++ b/libcloud/test/compute/test_cloudstack.py @@ -222,6 +222,7 @@ class CloudStackCommonTestCase(TestCaseMixin): self.assertEqual(node.extra['key_name'], 'foobar') def test_create_node_ex_userdata(self): + self.driver.path = '/test/path/userdata' size = self.driver.list_sizes()[0] image = self.driver.list_images()[0] location = self.driver.list_locations()[0] @@ -1307,6 +1308,11 @@ class CloudStackMockHttp(MockHttpTestCase): body, obj = self._load_fixture(fixture) return (httplib.OK, body, obj, httplib.responses[httplib.OK]) + def _test_path_userdata(self, method, url, body, headers): + if 'deployVirtualMachine' in url: + self.assertUrlContainsQueryParams(url, {'userdata': 'Zm9vYmFy'}) + return self._test_path(method, url, body, headers) + def _cmd_queryAsyncJobResult(self, jobid): fixture = 'queryAsyncJobResult' + '_' + str(jobid) + '.json' body, obj = self._load_fixture(fixture)
