bugfix: show testcase api return type error 41/41941/1
authorrexlee8776 <limingjiang@huawei.com>
Thu, 14 Sep 2017 09:25:53 +0000 (09:25 +0000)
committerrexlee8776 <limingjiang@huawei.com>
Thu, 14 Sep 2017 09:25:53 +0000 (09:25 +0000)
segmentation_id should be number, provider should be string

Change-Id: Iabdc08cb0989f4d585013b5a8ef3662442eeda45
Signed-off-by: rexlee8776 <limingjiang@huawei.com>
api/resources/v2/testcases.py

index 316ef26..0edbf62 100644 (file)
@@ -60,7 +60,13 @@ class V2Testcase(ApiResource):
 
         options = {k: {'description': '', 'type': v.__class__.__name__}
                    for k, v in jinja2schema.infer(data).items()}
-
+        # [('segmentation_id', < scalar >), ('image', < string >), ('provider', < scalar >),
+        # ('physical_network', < string >), ('packetsize', < number >)]
+        for k, v in options.items():
+            if k == 'segmentation_id':
+                options[k]['type'] = 'Number'
+            if k == 'provider':
+                options[k]['type'] = 'String'
         return result_handler(consts.API_SUCCESS, {'testcase': data, 'args': options})
 
     def delete(self, case_name):