Add UT for vesagent tasks_processBacklogs 11/54911/1
authorYun Huang <yun.huang@windriver.com>
Fri, 15 Jun 2018 02:47:30 +0000 (10:47 +0800)
committerYun Huang <yun.huang@windriver.com>
Fri, 15 Jun 2018 02:47:30 +0000 (10:47 +0800)
Change-Id: Icdaea1e1d1c0cf7f10b4e64b53a2616c6c3abdea
Issue-ID: MULTICLOUD-230
Signed-off-by: Yun Huang <yun.huang@windriver.com>
windriver/titanium_cloud/vesagent/tests_tasks.py

index ae3c971..e749dd8 100644 (file)
@@ -67,4 +67,16 @@ class VesTaskTest(unittest.TestCase):
         self.assertEquals(None, result)
         pass
 
+    @mock.patch.object(tasks, 'processBacklogsOfOneVIM')
+    @mock.patch.object(cache, 'get')
+    def test_tasks_processBacklogs(self, mock_cache_get, mock_tasks_processBacklogsOfOneVIM):
+        mock_VesAgentBacklogs_vimlist = ["windriver-hudson-dc_RegionOne"]
+        COUNT_TIME_SLOT_ONE_VIM = (1, 1)
+        mock_tasks_processBacklogsOfOneVIM.return_value = COUNT_TIME_SLOT_ONE_VIM
+        mock_cache_get.side_effect= [
+                    json.dumps(mock_VesAgentBacklogs_vimlist),
+                ]
+        result = tasks.processBacklogs()
+        self.assertEquals(COUNT_TIME_SLOT_ONE_VIM, result)
+        pass