Fix vfc-gvnfmadapter unit tests 69/14769/1
authorying.yunlong <ying.yunlong@zte.com.cn>
Sat, 23 Sep 2017 01:58:19 +0000 (09:58 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Sat, 23 Sep 2017 01:58:19 +0000 (09:58 +0800)
Change-Id: I630c9317435aee1ba69a2b7aa442f4021b1be6e5
Issue-ID: VFC-438
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
gvnfmadapter/driver/interfaces/tests.py

index 68e84b5..090cda9 100644 (file)
@@ -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')