diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2016-05-31 08:59:42 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-05-31 08:59:42 +0000 |
commit | 1e2c8d51ccc9720758f01e418957fdd826c278df (patch) | |
tree | 6d4980a983b4d01f9f925b7f8407a18541c1dc2c /utils/test/result_collection_api/resources/models.py | |
parent | 16dff1bf982d842bcdd717ff8c69627f1cdbdb52 (diff) | |
parent | c013525b837ab047cd6a3583b31b4a8253cb7932 (diff) |
Merge "bugfix: version return body is inconsistent with the designed model"
Diffstat (limited to 'utils/test/result_collection_api/resources/models.py')
-rw-r--r-- | utils/test/result_collection_api/resources/models.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/utils/test/result_collection_api/resources/models.py b/utils/test/result_collection_api/resources/models.py index 3c834fd48..7241bb7a8 100644 --- a/utils/test/result_collection_api/resources/models.py +++ b/utils/test/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
|