summaryrefslogtreecommitdiffstats
path: root/utils/test/result_collection_api/resources/pod_handlers.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-05-27 16:55:17 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-05-27 16:58:48 +0800
commitfd767d0b24749d5834a4aae85785a2e397da34bf (patch)
tree1b57fa64896dc9fa79d833ef06a80fd4dc363b30 /utils/test/result_collection_api/resources/pod_handlers.py
parent6668fa4f4c1b660dc130775b3a3d8c38d6646e8d (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 'utils/test/result_collection_api/resources/pod_handlers.py')
-rw-r--r--utils/test/result_collection_api/resources/pod_handlers.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/utils/test/result_collection_api/resources/pod_handlers.py b/utils/test/result_collection_api/resources/pod_handlers.py
index 590ae5baf..c50ec51e3 100644
--- a/utils/test/result_collection_api/resources/pod_handlers.py
+++ b/utils/test/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