From 5362ddab5a739f5198d3e7918b6059c27a4eac09 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Thu, 26 May 2016 20:32:02 +0800 Subject: swagger-ize project-apis of testAPI rename pod_handler.py to pod_handlers.py JIRA: FUNCTEST-264 Change-Id: I8699999776bdb238f680a128b83cea0a098534c5 Signed-off-by: SerenaFeng --- .../resources/project_models.py | 34 +++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'utils/test/result_collection_api/resources/project_models.py') diff --git a/utils/test/result_collection_api/resources/project_models.py b/utils/test/result_collection_api/resources/project_models.py index 895fc3e5e..a8f830932 100644 --- a/utils/test/result_collection_api/resources/project_models.py +++ b/utils/test/result_collection_api/resources/project_models.py @@ -1,7 +1,23 @@ +from tornado_swagger_ui.tornado_swagger import swagger + __author__ = '__serena__' +@swagger.model() class ProjectCreateRequest(object): + def __init__(self, name, description=''): + self.name = name + self.description = description + + def format(self): + return { + "name": self.name, + "description": self.description, + } + + +@swagger.model() +class ProjectUpdateRequest(object): def __init__(self, name='', description=''): self.name = name self.description = description @@ -13,14 +29,14 @@ class ProjectCreateRequest(object): } +@swagger.model() class Project: - """ Describes a test project""" - - def __init__(self): - self._id = None - self.name = None - self.description = None - self.creation_date = None + def __init__(self, + name=None, _id=None, description=None, create_date=None): + self._id = _id + self.name = name + self.description = description + self.creation_date = create_date @staticmethod def from_dict(res_dict): @@ -52,7 +68,11 @@ class Project: } +@swagger.model() class Projects(object): + """ + @ptype projects: C{list} of L{Project} + """ def __init__(self, projects=list()): self.projects = projects -- cgit 1.2.3-korg