summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/tests/unit/executor.py
diff options
context:
space:
mode:
authorgrakiss <grakiss.wanglei@huawei.com>2017-07-07 15:06:29 +0800
committergrakiss <grakiss.wanglei@huawei.com>2017-07-20 09:51:50 +0800
commitcf402a2a6888ade5c57165dc978a59d2330307a7 (patch)
tree64031db8f9b231867ab2466679b23eb6ade79b37 /testapi/opnfv_testapi/tests/unit/executor.py
parent0c684cf169699a48570cb96c565d40007d4f006f (diff)
role based access control and result upload
1. add role for user 2. user can upload test results Change-Id: I1c5370be7818edb0394f05e8b81f975deb98b286 Signed-off-by: grakiss <grakiss.wanglei@huawei.com>
Diffstat (limited to 'testapi/opnfv_testapi/tests/unit/executor.py')
-rw-r--r--testapi/opnfv_testapi/tests/unit/executor.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/testapi/opnfv_testapi/tests/unit/executor.py b/testapi/opnfv_testapi/tests/unit/executor.py
index b30c325..b8f696c 100644
--- a/testapi/opnfv_testapi/tests/unit/executor.py
+++ b/testapi/opnfv_testapi/tests/unit/executor.py
@@ -10,6 +10,20 @@ import functools
import httplib
+def upload(excepted_status, excepted_response):
+ def _upload(create_request):
+ @functools.wraps(create_request)
+ def wrap(self):
+ request = create_request(self)
+ status, body = self.upload(request)
+ if excepted_status == httplib.OK:
+ getattr(self, excepted_response)(body)
+ else:
+ self.assertIn(excepted_response, body)
+ return wrap
+ return _upload
+
+
def create(excepted_status, excepted_response):
def _create(create_request):
@functools.wraps(create_request)