From 473fcf4ec62514c6ca255a8db89a73d650d07692 Mon Sep 17 00:00:00 2001 From: "ying.yunlong" Date: Sat, 23 Sep 2017 09:58:19 +0800 Subject: Fix vfc-gvnfmadapter unit tests Change-Id: I630c9317435aee1ba69a2b7aa442f4021b1be6e5 Issue-ID: VFC-438 Signed-off-by: ying.yunlong --- gvnfmadapter/driver/interfaces/tests.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/gvnfmadapter/driver/interfaces/tests.py b/gvnfmadapter/driver/interfaces/tests.py index 68e84b5..090cda9 100644 --- a/gvnfmadapter/driver/interfaces/tests.py +++ b/gvnfmadapter/driver/interfaces/tests.py @@ -224,29 +224,41 @@ class InterfacesTest(TestCase): @mock.patch.object(restcall, 'call_req') def test_grantvnf(self, mock_call_req): - vim_info = {"vim":{"accessinfo":{"tenant":"admin"},"vimid":"516cee95-e8ca-4d26-9268-38e343c2e31e"}} + vim_info = { + "vim": { + "accessinfo": { + "tenant": "admin" + }, + "vimid": "516cee95-e8ca-4d26-9268-38e343c2e31e" + } + } req_data = { "vnfmid": "13232222", "nfvoid": "03212234", "vimid": "12345678", - "exvimidlist ":["exvimid"], + "exvimidlist ": "exvimid", "tenant": " tenant1", "vnfistanceid": "1234", "operationright": "0", "vmlist": [ { "vmflavor": "SMP", - "vmnumber": "3"}, + "vmnumber": "3" + }, { "vmflavor": "CMP", - "vmnumber": "3"} + "vmnumber": "3" + } ] } mock_call_req.return_value = [0, json.JSONEncoder().encode(vim_info), '201'] response = self.client.put("/api/gvnfmdriver/v1/resource/grant", data=json.dumps(req_data), content_type='application/json') self.assertEqual(str(status.HTTP_201_CREATED), response.status_code) - expect_resp_data = {"vimid": "516cee95-e8ca-4d26-9268-38e343c2e31e", "tenant": "admin"} + expect_resp_data = { + "vimid": "516cee95-e8ca-4d26-9268-38e343c2e31e", + "tenant": "admin" + } self.assertDictEqual(expect_resp_data, response.data) @mock.patch.object(restcall, 'call_req') -- cgit 1.2.3-korg