1 ##############################################################################
2 # Copyright (c) 2015 Orange
3 # guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
12 """ describes a POD platform """
16 self.creation_date = ""
21 def pod_from_dict(pod_dict):
26 p._id = pod_dict.get('_id')
27 p.creation_date = str(pod_dict.get('creation_date'))
28 p.name = pod_dict.get('name')
29 p.mode = pod_dict.get('mode')
30 p.details = pod_dict.get('details')
37 "details": self.details,
38 "creation_date": str(self.creation_date),
41 def format_http(self):
46 "details": self.details,
47 "creation_date": str(self.creation_date),
52 """ Describes a test project"""
57 self.description = None
58 self.creation_date = None
61 def testproject_from_dict(testproject_dict):
63 if testproject_dict is None:
67 t._id = testproject_dict.get('_id')
68 t.creation_date = testproject_dict.get('creation_date')
69 t.name = testproject_dict.get('name')
70 t.description = testproject_dict.get('description')
77 "description": self.description,
78 "creation_date": str(self.creation_date)
81 def format_http(self, test_cases=0):
85 "description": self.description,
86 "creation_date": str(self.creation_date),
87 "test_cases": test_cases
92 """ Describes a test case"""
97 self.project_name = None
98 self.description = None
100 self.creation_date = None
103 def test_case_from_dict(testcase_dict):
105 if testcase_dict is None:
109 t._id = testcase_dict.get('_id')
110 t.project_name = testcase_dict.get('project_name')
111 t.creation_date = testcase_dict.get('creation_date')
112 t.name = testcase_dict.get('name')
113 t.description = testcase_dict.get('description')
114 t.url = testcase_dict.get('url')
121 "description": self.description,
122 "project_name": self.project_name,
123 "creation_date": str(self.creation_date),
127 def format_http(self, test_project=None):
129 "_id": str(self._id),
131 "description": self.description,
132 "creation_date": str(self.creation_date),
135 if test_project is not None:
136 res["test_project"] = test_project
142 """ Describes a test result"""
146 self.case_name = None
147 self.project_name = None
149 self.installer = None
151 self.description = None
152 self.creation_date = None
156 def test_result_from_dict(test_result_dict):
158 if test_result_dict is None:
162 t._id = test_result_dict.get('_id')
163 t.case_name = test_result_dict.get('case_name')
164 t.pod_name = test_result_dict.get('pod_name')
165 t.project_name = test_result_dict.get('project_name')
166 t.description = test_result_dict.get('description')
167 t.creation_date = str(test_result_dict.get('creation_date'))
168 t.details = test_result_dict.get('details')
169 t.version = test_result_dict.get('version')
170 t.installer = test_result_dict.get('installer')
176 "case_name": self.case_name,
177 "project_name": self.project_name,
178 "pod_name": self.pod_name,
179 "description": self.description,
180 "creation_date": str(self.creation_date),
181 "version": self.version,
182 "installer": self.installer,
183 "details": self.details,
186 def format_http(self):
188 "_id": str(self._id),
189 "case_name": self.case_name,
190 "project_name": self.project_name,
191 "pod_name": self.pod_name,
192 "description": self.description,
193 "creation_date": str(self.creation_date),
194 "version": self.version,
195 "installer": self.installer,
196 "details": self.details,