summaryrefslogtreecommitdiffstats
path: root/windriver/titanium_cloud/vesagent/tests.py
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-06-15 14:12:26 +0800
committerYun Huang <yun.huang@windriver.com>2018-06-15 14:12:26 +0800
commit6cfb44195ad3fc40f113395fb54c7d5113527762 (patch)
treeef7a5a5a357a73060dc3de25c7c551f473df1b77 /windriver/titanium_cloud/vesagent/tests.py
parentca4c2b3c713e1cbc58afb1a1edc08193cb85a8aa (diff)
Test case for buildBacklogsOneVIM
Change-Id: I50ae92ecc09652f09fd6f5f2223bf2461e4c0e39 Issue-ID: MULTICLOUD-230 Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'windriver/titanium_cloud/vesagent/tests.py')
-rw-r--r--windriver/titanium_cloud/vesagent/tests.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/windriver/titanium_cloud/vesagent/tests.py b/windriver/titanium_cloud/vesagent/tests.py
index 9602b778..5c4348c2 100644
--- a/windriver/titanium_cloud/vesagent/tests.py
+++ b/windriver/titanium_cloud/vesagent/tests.py
@@ -123,5 +123,34 @@ class VesAgentCtrlTest(unittest.TestCase):
result = self.view.clearBacklogsOneVIM(vimid="windriver-hudson-dc_RegionOne")
self.assertEquals(0, result)
+ pass
+
+ from titanium_cloud.vesagent.tasks import scheduleBacklogs
+
+ @mock.patch.object(scheduleBacklogs, 'delay')
+ @mock.patch.object(cache, 'set')
+ @mock.patch.object(cache, 'get')
+ def test_buildBacklogsOneVIM(self, mock_get, mock_set, mock_scheduleBacklogs_delay):
+ mock_VesAgentBacklogs_vimlist = ["windriver-hudson-dc_RegionOne"]
+ mock_vesagent_config = {"backlogs": [{"backlog_uuid": "ce2d7597-22e1-4239-890f-bc303bd67076",
+ "server_id": "c4b575fa-ed85-4642-ab4b-335cb5744721",
+ "tenant_id": "0e148b76ee8c42f78d37013bf6b7b1ae", "api_method": "GET",
+ "source": "onap-aaf",
+ "api_link": "/onaplab_RegionOne/compute/v2.1/0e148b76ee8c42f78d37013bf6b7b1ae/servers/c4b575fa-ed85-4642-ab4b-335cb5744721",
+ "domain": "fault", "type": "vm", "tenant": "VIM"}],
+ "poll_interval_default": 10, "vimid": "windriver-hudson-dc_RegionOne",
+ "ves_subscription": {"username": "user", "password": "password",
+ "endpoint": "http://127.0.0.1:9005/sample"}}
+
+ mock_get.side_effect= [
+ json.dumps(mock_VesAgentBacklogs_vimlist),
+ ]
+
+ mock_set.return_value = "mocked cache set"
+ mock_scheduleBacklogs_delay.return_value = "mocked delay"
+
+ VesAgentBacklogsConfig = self.view.buildBacklogsOneVIM(vimid="windriver-hudson-dc_RegionOne",
+ vesagent_config = mock_vesagent_config)
+ self.assertIsNotNone(VesAgentBacklogsConfig)
pass