From ceda84d021dde70299f96984ca7aec16740854be Mon Sep 17 00:00:00 2001 From: Shadi Haidar Date: Fri, 7 Sep 2018 22:05:43 -0400 Subject: Check deployment creation before install Unit Test Code Coverage: Statements : 76.85% ( 893/1162 ) Branches : 52.99% ( 275/519 ) Functions : 78.68% ( 155/197 ) Lines : 77.21% ( 884/1145 ) Issue-ID: DCAEGEN2-754 Change-Id: Id8f3fa26e8ece7e9099145ea20034829a1ad7d13 Signed-off-by: Shadi Haidar --- tests/test_dcae-deployments.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/test_dcae-deployments.js b/tests/test_dcae-deployments.js index a010017..ca64d94 100644 --- a/tests/test_dcae-deployments.js +++ b/tests/test_dcae-deployments.js @@ -174,6 +174,23 @@ const Cloudify = { "blueprint_id": blueprint_id || deployment_id }; }, + resp_dep_creation: function(deployment_id) { + return { + "items": [ + { + "status": "terminated", + "id": "ee6b0d21-0257-46a3-bb83-6f61f9ab5f99" + } + ], + "metadata": { + "pagination": { + "total": 1, + "offset": 0, + "size": 10000 + } + } + }; + }, resp_execution: function(deployment_id, blueprint_id, execution_id, terminated, workflow_id) { return { "status": (terminated && "terminated") || "pending", @@ -406,6 +423,12 @@ function test_put_dcae_deployments_success(dh_server) { return JSON.stringify(Cloudify.resp_deploy(DEPLOYMENT_ID_JFL_1, DEPLOYMENT_ID_JFL_1, message.inputs)); }); + nock(dh.CLOUDIFY_URL).get("/api/v2.1/executions?deployment_id=" + DEPLOYMENT_ID_JFL_1 + "&workflow_id=create_deployment_environment&_include=id,status") + .reply(200, function(uri) { + console.log(action_timer.step, "get", dh.CLOUDIFY_URL, uri); + return JSON.stringify(Cloudify.resp_dep_creation(DEPLOYMENT_ID_JFL_1)); + }); + nock(dh.CLOUDIFY_URL).post("/api/v2.1/executions") .reply(201, function(uri, requestBody) { console.log(action_timer.step, "post", dh.CLOUDIFY_URL, uri, JSON.stringify(requestBody)); -- cgit 1.2.3-korg