summaryrefslogtreecommitdiffstats
path: root/utils/test/result_collection_api/resources
diff options
context:
space:
mode:
Diffstat (limited to 'utils/test/result_collection_api/resources')
-rw-r--r--utils/test/result_collection_api/resources/handlers.py5
-rw-r--r--utils/test/result_collection_api/resources/models.py25
2 files changed, 26 insertions, 4 deletions
diff --git a/utils/test/result_collection_api/resources/handlers.py b/utils/test/result_collection_api/resources/handlers.py
index a2c6b8d01..0977ef07e 100644
--- a/utils/test/result_collection_api/resources/handlers.py
+++ b/utils/test/result_collection_api/resources/handlers.py
@@ -223,7 +223,8 @@ class VersionHandler(GenericApiHandler):
@swagger.operation(nickname='list')
def get(self):
"""
- @description: Display a message for the API version
+ @description: list all supported versions
@rtype: L{Versions}
"""
- self.finish_request([{'v1': 'basics'}])
+ versions = [{'version': 'v1.0', 'description': 'basics'}]
+ self.finish_request({'versions': versions})
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