summaryrefslogtreecommitdiffstats
path: root/utils/test/result_collection_api/resources/models.py
blob: 3c834fd489c935fea2a5e5e478689db7711f3cb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
##############################################################################
# Copyright (c) 2015 Orange
# guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# feng.xiaowei@zte.com.cn  mv Pod to pod_models.py                 5-18-2016
# feng.xiaowei@zte.com.cn  add MetaCreateResponse/MetaGetResponse  5-18-2016
# feng.xiaowei@zte.com.cn  mv TestProject to project_models.py     5-19-2016
# feng.xiaowei@zte.com.cn  delete meta class                       5-19-2016
# feng.xiaowei@zte.com.cn  add CreateResponse                      5-19-2016
# feng.xiaowei@zte.com.cn  mv TestCase to testcase_models.py       5-20-2016
# feng.xiaowei@zte.com.cn  mv TestResut to result_models.py        5-23-2016
##############################################################################
from tornado_swagger_ui.tornado_swagger import swagger


class CreateResponse(object):
    def __init__(self, href=''):
        self.href = href

    @staticmethod
    def from_dict(res_dict):
        if res_dict is None:
            return None

        res = CreateResponse()
        res.href = res_dict.get('href')
        return res

    def format(self):
        return {'href': self.href}


@swagger.model()
class Versions(object):
    """
        @ptype versions: C{list} of L{Version}
    """
    def __init__(self, versions):
        self.versions = versions


@swagger.model()
class Version(object):
    def __init__(self, version=None, description=None):
        self.version = version
        self.description = description