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),
91 """ Describes a test case"""
96 self.project_name = None
97 self.description = None
99 self.creation_date = None
102 def test_case_from_dict(testcase_dict):
104 if testcase_dict is None:
108 t._id = testcase_dict.get('_id')
109 t.project_name = testcase_dict.get('project_name')
110 t.creation_date = testcase_dict.get('creation_date')
111 t.name = testcase_dict.get('name')
112 t.description = testcase_dict.get('description')
113 t.url = testcase_dict.get('url')
120 "description": self.description,
121 "project_name": self.project_name,
122 "creation_date": str(self.creation_date),
126 def format_http(self, test_project=None):
128 "_id": str(self._id),
130 "description": self.description,
131 "creation_date": str(self.creation_date),
134 if test_project is not None:
135 res["test_project"] = test_project
141 """ Describes a test result"""
145 self.case_name = None
146 self.project_name = None
148 self.installer = None
150 self.description = None
151 self.creation_date = None
155 def test_result_from_dict(test_result_dict):
157 if test_result_dict is None:
161 t._id = test_result_dict.get('_id')
162 t.case_name = test_result_dict.get('case_name')
163 t.pod_name = test_result_dict.get('pod_name')
164 t.project_name = test_result_dict.get('project_name')
165 t.description = test_result_dict.get('description')
166 t.creation_date = str(test_result_dict.get('creation_date'))
167 t.details = test_result_dict.get('details')
168 t.version = test_result_dict.get('version')
169 t.installer = test_result_dict.get('installer')
175 "case_name": self.case_name,
176 "project_name": self.project_name,
177 "pod_name": self.pod_name,
178 "description": self.description,
179 "creation_date": str(self.creation_date),
180 "version": self.version,
181 "installer": self.installer,
182 "details": self.details,
185 def format_http(self):
187 "_id": str(self._id),
188 "case_name": self.case_name,
189 "project_name": self.project_name,
190 "pod_name": self.pod_name,
191 "description": self.description,
192 "creation_date": str(self.creation_date),
193 "version": self.version,
194 "installer": self.installer,
195 "details": self.details,