summaryrefslogtreecommitdiffstats
path: root/ocata
diff options
context:
space:
mode:
Diffstat (limited to 'ocata')
-rw-r--r--ocata/ocata/vesagent/tests.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/ocata/ocata/vesagent/tests.py b/ocata/ocata/vesagent/tests.py
index 9f34b3f5..4f6d58fb 100644
--- a/ocata/ocata/vesagent/tests.py
+++ b/ocata/ocata/vesagent/tests.py
@@ -21,6 +21,7 @@ from rest_framework import status
from django.core.cache import cache
from common.msapi import extsys
+from ocata.vesagent import vesagent_ctrl
@@ -45,6 +46,7 @@ MOCK_VIM_INFO = {
class VesAgentCtrlTest(unittest.TestCase):
def setUp(self):
self.client = Client()
+ self.view = vesagent_ctrl.VesAgentCtrl()
def tearDown(self):
pass
@@ -57,3 +59,17 @@ class VesAgentCtrlTest(unittest.TestCase):
response = self.client.get("/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/vesagent")
self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
+
+ @mock.patch.object(vesagent_ctrl.VesAgentCtrl, 'buildBacklogsOneVIM')
+ @mock.patch.object(extsys, 'get_vim_by_id')
+ def test_post(self, mock_get_vim_by_id, mock_buildBacklogsOneVIM):
+ mock_get_vim_by_id.return_value = MOCK_VIM_INFO
+ mock_buildBacklogsOneVIM.return_value = "mocked vesagent_backlogs"
+ mock_request = mock.Mock()
+ mock_request.META = {"testkey":"testvalue"}
+ mock_request.data = {"testdatakey":"testdatavalue"}
+
+ response = self.view.post(request=mock_request, vimid="windriver-hudson-dc_RegionOne")
+ self.assertEquals(status.HTTP_201_CREATED, response.status_code)
+
+ pass