From 20826c00015567244153ab2e7b39452600fd38c7 Mon Sep 17 00:00:00 2001 From: grakiss Date: Fri, 7 Jul 2017 15:06:29 +0800 Subject: 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 --- utils/test/testapi/opnfv_testapi/tests/unit/executor.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'utils/test/testapi/opnfv_testapi/tests/unit/executor.py') diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/executor.py b/utils/test/testapi/opnfv_testapi/tests/unit/executor.py index b30c3258b..b8f696caf 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/executor.py +++ b/utils/test/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) -- cgit 1.2.3-korg