summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pike/pike/resource/tests/tests_infra_workload.py45
-rw-r--r--pike/pike/resource/views/infra_workload.py2
2 files changed, 46 insertions, 1 deletions
diff --git a/pike/pike/resource/tests/tests_infra_workload.py b/pike/pike/resource/tests/tests_infra_workload.py
index 51fd0837..48c29d15 100644
--- a/pike/pike/resource/tests/tests_infra_workload.py
+++ b/pike/pike/resource/tests/tests_infra_workload.py
@@ -159,6 +159,28 @@ class InfraWorkloadTest(unittest.TestCase):
pass
+ @mock.patch.object(helper, 'MultiCloudServiceHelper')
+ @mock.patch.object(helper, 'MultiCloudIdentityHelper')
+ def test_delete(self, mock_MultiCloudIdentityHelper, mock_MultiCloudServiceHelper):
+ mock_request = mock.Mock()
+ mock_request.META = {"testkey": "testvalue"}
+
+ mock_MultiCloudIdentityHelper.side_effect= [
+ (0, MOCK_TOKEN_RESPONSE, status.HTTP_201_CREATED)
+ ]
+
+ mock_MultiCloudServiceHelper.side_effect= [
+ (0, MOCK_HEAT_LIST_RESPONSE1, status.HTTP_200_OK)
+ ]
+
+ vimid = "CloudOwner_Region1"
+ mock_stack_id = "MOCKED_HEAT_STACK_ID1"
+
+ response = self._InfraWorkload.delete(mock_request, vimid, mock_stack_id)
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ pass
+
+
class APIv1InfraWorkloadTest(unittest.TestCase):
def setUp(self):
self._APIv1InfraWorkload = APIv1InfraWorkload()
@@ -212,3 +234,26 @@ class APIv1InfraWorkloadTest(unittest.TestCase):
response = self._APIv1InfraWorkload.get(mock_request, cloud_owner, cloud_region_id, mock_stack_id)
self.assertEqual(response.status_code, status.HTTP_200_OK)
pass
+
+
+ @mock.patch.object(helper, 'MultiCloudServiceHelper')
+ @mock.patch.object(helper, 'MultiCloudIdentityHelper')
+ def test_delete(self, mock_MultiCloudIdentityHelper, mock_MultiCloudServiceHelper):
+ mock_request = mock.Mock()
+ mock_request.META = {"testkey": "testvalue"}
+
+ mock_MultiCloudIdentityHelper.side_effect= [
+ (0, MOCK_TOKEN_RESPONSE, status.HTTP_201_CREATED)
+ ]
+
+ mock_MultiCloudServiceHelper.side_effect= [
+ (0, MOCK_HEAT_LIST_RESPONSE1, status.HTTP_200_OK)
+ ]
+
+ cloud_owner = "CloudOwner"
+ cloud_region_id = "Region1"
+ mock_stack_id = "MOCKED_HEAT_STACK_ID1"
+
+ response = self._APIv1InfraWorkload.delete(mock_request, cloud_owner, cloud_region_id, mock_stack_id)
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ pass
diff --git a/pike/pike/resource/views/infra_workload.py b/pike/pike/resource/views/infra_workload.py
index 80cb112e..3e144e7f 100644
--- a/pike/pike/resource/views/infra_workload.py
+++ b/pike/pike/resource/views/infra_workload.py
@@ -303,7 +303,7 @@ class InfraWorkload(APIView):
return aai_transactions
def delete(self, request, vimid="", requri=""):
- self._logger.info("vimid, requri: %s" % (vimid, requri))
+ self._logger.info("vimid, requri: %s, %s" % (vimid, requri))
self._logger.debug("META: %s" % request.META)
try :