summaryrefslogtreecommitdiffstats
path: root/cvp/opnfv_testapi
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2018-01-22 02:11:31 +0000
committerLeo wang <grakiss.wanglei@huawei.com>2018-01-29 01:14:43 +0000
commit8a37433b41b5ba42eaa403b1f39845f0ab3edc98 (patch)
treea08b32993a4a3e4ad206b449b6ed7bb8b692aa30 /cvp/opnfv_testapi
parent4500235246e12c96b38b683ec27a23a9e144d105 (diff)
Don't allow user change SUT version to None after submitting
We don't allow SUT version to be None when submitting test. So we also not allow user to change it to Nonw after submitting. In this patch, I also make the result table self-adaption. Change-Id: I5c391592dcbdbd9eb8697e44d7bb5dda41431bd6 Signed-off-by: chenjiankun <chenjiankun1@huawei.com> (cherry picked from commit 5dc6cab4205eb298f0494c3c0e9b887658793bcf)
Diffstat (limited to 'cvp/opnfv_testapi')
-rw-r--r--cvp/opnfv_testapi/resources/test_handlers.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/cvp/opnfv_testapi/resources/test_handlers.py b/cvp/opnfv_testapi/resources/test_handlers.py
index b28a15d3..77656ae9 100644
--- a/cvp/opnfv_testapi/resources/test_handlers.py
+++ b/cvp/opnfv_testapi/resources/test_handlers.py
@@ -196,10 +196,16 @@ class TestsGURHandler(GenericTestHandler):
return
curr_user = self.get_secure_cookie(auth_const.OPENID)
- if item in {"shared", "label"}:
+ if item in {"shared", "label", "sut_label"}:
query['owner'] = curr_user
db_keys.append('owner')
+ if item == 'sut_label':
+ if test['status'] != 'private' and not value:
+ msg = 'SUT version cannot be changed to None after submitting.'
+ self.finish_request({'code': 403, 'msg': msg})
+ return
+
if item == "status":
if value in {'approved', 'not approved'}:
if test['status'] == 'private':