From 60a9d754a14dc87dda5a7fb045e48c323189eef6 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Tue, 31 May 2016 14:32:35 +0800 Subject: bugfix: version return body is inconsistent with the designed model JIRA: FUNCTEST-278 Change-Id: I53fa2eca6476c07ad513e72241d9715431cbdee8 Signed-off-by: SerenaFeng --- result_collection_api/resources/models.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'result_collection_api/resources/models.py') diff --git a/result_collection_api/resources/models.py b/result_collection_api/resources/models.py index 3c834fd..7241bb7 100644 --- a/result_collection_api/resources/models.py +++ b/result_collection_api/resources/models.py @@ -36,10 +36,21 @@ class CreateResponse(object): @swagger.model() class Versions(object): """ + @property versions: @ptype versions: C{list} of L{Version} """ - def __init__(self, versions): - self.versions = versions + def __init__(self): + self.versions = list() + + @staticmethod + def from_dict(res_dict): + if res_dict is None: + return None + + res = Versions() + for version in res_dict.get('versions'): + res.versions.append(Version.from_dict(version)) + return res @swagger.model() @@ -47,3 +58,13 @@ class Version(object): def __init__(self, version=None, description=None): self.version = version self.description = description + + @staticmethod + def from_dict(a_dict): + if a_dict is None: + return None + + ver = Version() + ver.version = a_dict.get('version') + ver.description = str(a_dict.get('description')) + return ver -- cgit 1.2.3-korg