Added ex_deploy tests.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c1da02c6 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c1da02c6 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c1da02c6 Branch: refs/heads/trunk Commit: c1da02c6c044ada458935efa04729114dff1d8e5 Parents: ff08c11 Author: Juan Font Alonso <juanfontalo...@gmail.com> Authored: Fri Jun 24 11:39:07 2016 +0200 Committer: Juan Font Alonso <juanfontalo...@gmail.com> Committed: Fri Jun 24 11:39:07 2016 +0200 ---------------------------------------------------------------------- .../fixtures/vcloud_1_5/api_task_deploy.xml | 7 +++++++ libcloud/test/compute/test_vcloud.py | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/c1da02c6/libcloud/test/compute/fixtures/vcloud_1_5/api_task_deploy.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/fixtures/vcloud_1_5/api_task_deploy.xml b/libcloud/test/compute/fixtures/vcloud_1_5/api_task_deploy.xml new file mode 100644 index 0000000..c799b78 --- /dev/null +++ b/libcloud/test/compute/fixtures/vcloud_1_5/api_task_deploy.xml @@ -0,0 +1,7 @@ +<Task status="success" startTime="2012-01-11T04:11:06.125-05:00" operationName="vappDeploy" operation="Starting Virtual Application (b0331206-dcc4-4874-b90a-351ff6502124)" expiryTime="2012-04-10T04:11:06.125-04:00" name="task" id="urn:vcloud:task:54516828-af1e-4723-9a0e-7783b0065d39" type="application/vnd.vmware.vcloud.task+xml" + href="https://vm-vcloud/api/task/deploy" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://65.41.64.27/api/v1.5/schema/master.xsd" xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Link rel="task:cancel" href="https://vm-vcloud/api/task/54516828-af1e-4723-9a0e-7783b0065d39/action/cancel"/> + <Owner type="application/vnd.vmware.vcloud.vApp+xml" name="" href="https://vm-vcloud/api/vApp/vapp-b0331206-dcc4-4874-b90a-351ff6502124"/> + <User type="application/vnd.vmware.admin.user+xml" name="labmanapi" href="https://vm-vcloud/api/admin/user/46f62cc3-65e0-4417-967a-a538ec6caea3"/> + <Organization type="application/vnd.vmware.vcloud.org+xml" name="MyOrg" href="https://vm-vcloud/api/org/96726c78-4ae3-402f-b08b-7a78c6903d2a"/> +</Task> http://git-wip-us.apache.org/repos/asf/libcloud/blob/c1da02c6/libcloud/test/compute/test_vcloud.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_vcloud.py b/libcloud/test/compute/test_vcloud.py index 74acaeb..9ba1d34 100644 --- a/libcloud/test/compute/test_vcloud.py +++ b/libcloud/test/compute/test_vcloud.py @@ -209,6 +209,13 @@ class VCloud_1_5_Tests(unittest.TestCase, TestCaseMixin): self.assertFalse(self.driver._is_node( NodeImage('testId', 'testNode', driver=self.driver))) + def test_ex_deploy(self): + node = self.driver.ex_deploy_node( + Node('/api/vApp/vapp-8c57a5b6-e61b-48ca-8a78-3b70ee65ef6a', 'testNode', state=0, + public_ips=[], private_ips=[], driver=self.driver), + ex_force_customization=False) + self.assertEqual(node.state, NodeState.RUNNING) + def test_ex_undeploy(self): node = self.driver.ex_undeploy_node( Node('https://test/api/vApp/undeployTest', 'testNode', state=0, @@ -628,6 +635,18 @@ class VCloud_1_5_MockHttp(MockHttp, unittest.TestCase): 'api_catalogItem_3132e037_759b_4627_9056_ca66466fa607.xml') return httplib.OK, body, headers, httplib.responses[httplib.OK] + def _api_vApp_deployTest(self, method, url, body, headers): + body = self.fixtures.load('api_task_deploy.xml') + return httplib.OK, body, headers, httplib.responses[httplib.OK] + + def _api_vApp_vapp_8c57a5b6_e61b_48ca_8a78_3b70ee65ef6a_action_deploy(self, method, url, body, headers): + body = self.fixtures.load('api_task_deploy.xml') + return httplib.ACCEPTED, body, headers, httplib.responses[httplib.ACCEPTED] + + def _api_task_deploy(self, method, url, body, headers): + body = self.fixtures.load('api_task_deploy.xml') + return httplib.ACCEPTED, body, headers, httplib.responses[httplib.ACCEPTED] + def _api_vApp_undeployTest(self, method, url, body, headers): body = self.fixtures.load('api_vApp_undeployTest.xml') return httplib.OK, body, headers, httplib.responses[httplib.OK]