diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-10-20 15:21:59 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-10-20 15:21:59 +0800 |
commit | c0de44528cb8fdfb7d29158909a589db3628d889 (patch) | |
tree | 3662a1b185b3a7001ad64a90677841edfb0079a7 /utils/test/testapi/opnfv_testapi/resources | |
parent | b7972b02c75fd3a6b4d88ccfb3a1581c21868601 (diff) |
criteria field must be 'PASS/FAIL'
criteria must be fix with 'PASS/FAIL', case insensitive
or else, BADREQUEST exception will be raises
JIRA: RELENG-327
Change-Id: Ic648b9d38937fc63924e42cfdf5345cdaa32e1ed
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/resources')
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/handlers.py | 1 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/result_handlers.py | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/utils/test/testapi/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/resources/handlers.py index 8e5dab235..6c7a819c9 100644 --- a/utils/test/testapi/opnfv_testapi/resources/handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/handlers.py @@ -79,6 +79,7 @@ class GenericApiHandler(web.RequestHandler): @check.valid_token @check.no_body @check.miss_fields + @check.values_check @check.carriers_exist @check.new_not_exists def _create(self, **kwargs): diff --git a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py index e202f5c2c..a25852856 100644 --- a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py @@ -215,12 +215,18 @@ class ResultsCLHandler(GenericResultHandler): return {'project_name': self.json_args.get('project_name'), 'name': self.json_args.get('case_name')} + def options_check(field, options): + return self.json_args.get(field).upper() in options + miss_fields = ['pod_name', 'project_name', 'case_name'] carriers = [('pods', pod_query), ('projects', project_query), ('testcases', testcase_query)] + values_check = [('criteria', options_check, ['PASS', 'FAIL'])] - self._create(miss_fields=miss_fields, carriers=carriers) + self._create(miss_fields=miss_fields, + carriers=carriers, + values_check=values_check) class ResultsUploadHandler(ResultsCLHandler): |