diff options
author | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-09-23 09:58:19 +0800 |
---|---|---|
committer | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-09-23 09:58:19 +0800 |
commit | 473fcf4ec62514c6ca255a8db89a73d650d07692 (patch) | |
tree | ce5e7f1e1b5a7e35c946bba138799adc9f23e8e6 /gvnfmadapter | |
parent | 6813ac186ad710b48a4573b9345ee8205f965836 (diff) |
Fix vfc-gvnfmadapter unit tests
Change-Id: I630c9317435aee1ba69a2b7aa442f4021b1be6e5
Issue-ID: VFC-438
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
Diffstat (limited to 'gvnfmadapter')
-rw-r--r-- | gvnfmadapter/driver/interfaces/tests.py | 22 |
1 files 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') |