From 20bf0b46bf02659b499d73abed6ab695599ad2fd Mon Sep 17 00:00:00 2001 From: Huang Haibin Date: Tue, 11 Sep 2018 18:56:29 +0800 Subject: Test case for vesagent getBacklogsOneVIM in ocata Change-Id: I1e7693c1781080d7011a6156b7380c0670acf92c Issue-ID: MULTICLOUD-230 Signed-off-by: Huang Haibin --- ocata/ocata/vesagent/tests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ocata') diff --git a/ocata/ocata/vesagent/tests.py b/ocata/ocata/vesagent/tests.py index d6510e70..f9c71eb1 100644 --- a/ocata/ocata/vesagent/tests.py +++ b/ocata/ocata/vesagent/tests.py @@ -86,3 +86,13 @@ class VesAgentCtrlTest(unittest.TestCase): self.assertEquals(status.HTTP_200_OK, response.status_code) pass + + @mock.patch.object(cache, 'get') + def test_getBacklogsOneVIM(self, mock_get): + 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": "onaplab_RegionOne", "subscription": {"username": "user", "password": "password", "endpoint": "http://127.0.0.1:9005/sample"}} + mock_get.return_value = json.dumps(mock_vesagent_config) + + vesAgentConfig = self.view.getBacklogsOneVIM(vimid="windriver-hudson-dc_RegionOne") + self.assertEquals(vesAgentConfig, mock_vesagent_config) + + pass -- cgit 1.2.3-korg