diff options
author | 2016-05-27 16:55:17 +0800 | |
---|---|---|
committer | 2016-05-27 16:58:48 +0800 | |
commit | 3a03a7efbdaf54fa5789c8d08119c7ac5b8f0a08 (patch) | |
tree | 166aa5961b3e8fadff571a74cb252a624ecd3a5d /result_collection_api/resources/pod_handlers.py | |
parent | 07b1553b8f00933d7d0f057ac1558a4f7d80245e (diff) |
swagger-ize testcase-apis of testAPI
Change-Id: Ibe4b068fd667b796455be3fd4d9701d50879aace
JIRA: FUNCTEST-266
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'result_collection_api/resources/pod_handlers.py')
-rw-r--r-- | result_collection_api/resources/pod_handlers.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/result_collection_api/resources/pod_handlers.py b/result_collection_api/resources/pod_handlers.py index 590ae5b..c50ec51 100644 --- a/result_collection_api/resources/pod_handlers.py +++ b/result_collection_api/resources/pod_handlers.py @@ -1,9 +1,7 @@ -from tornado import gen -from tornado.web import asynchronous - from tornado_swagger_ui.tornado_swagger import swagger from handlers import GenericApiHandler from pod_models import Pod +from common.constants import HTTP_FORBIDDEN class GenericPodHandler(GenericApiHandler): @@ -23,7 +21,6 @@ class PodCLHandler(GenericPodHandler): """ self._list() - @gen.coroutine @swagger.operation(nickname='create') def post(self): """ @@ -36,7 +33,15 @@ class PodCLHandler(GenericPodHandler): @raise 403: pod already exists @raise 400: post without body """ - self._create('{} already exists as a {}') + def query(data): + return {'name': data.name} + + def error(data): + message = '{} already exists as a pod'.format(data.name) + return HTTP_FORBIDDEN, message + + db_check = [(self.table, False, query, error)] + self._create(db_check) class PodGURHandler(GenericPodHandler): @@ -52,8 +57,6 @@ class PodGURHandler(GenericPodHandler): query['name'] = pod_name self._get_one(query) - @asynchronous - @gen.coroutine def delete(self, pod_name): """ Remove a POD |