add test result/dashboard related unittests in testAPI and refactor its response
[releng.git] / utils / test / result_collection_api / resources / models.py
1 ##############################################################################\r
2 # Copyright (c) 2015 Orange\r
3 # guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com\r
4 # All rights reserved. This program and the accompanying materials\r
5 # are made available under the terms of the Apache License, Version 2.0\r
6 # which accompanies this distribution, and is available at\r
7 # http://www.apache.org/licenses/LICENSE-2.0\r
8 # feng.xiaowei@zte.com.cn  mv Pod to pod_models.py                 5-18-2016\r
9 # feng.xiaowei@zte.com.cn  add MetaCreateResponse/MetaGetResponse  5-18-2016\r
10 # feng.xiaowei@zte.com.cn  mv TestProject to project_models.py     5-19-2016\r
11 # feng.xiaowei@zte.com.cn  delete meta class                       5-19-2016\r
12 # feng.xiaowei@zte.com.cn  add CreateResponse                      5-19-2016\r
13 # feng.xiaowei@zte.com.cn  mv TestCase to testcase_models.py       5-20-2016\r
14 # feng.xiaowei@zte.com.cn  mv TestResut to result_models.py        5-23-2016\r
15 ##############################################################################\r
16 \r
17 \r
18 class CreateResponse(object):\r
19     def __init__(self, href=''):\r
20         self.href = href\r
21 \r
22     @staticmethod\r
23     def from_dict(res_dict):\r
24         if res_dict is None:\r
25             return None\r
26 \r
27         res = CreateResponse()\r
28         res.href = res_dict.get('href')\r
29         return res\r
30 \r
31     def format(self):\r
32         return {'href': self.href}\r