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 = ""
19 def pod_from_dict(pod_dict):
24 p._id = pod_dict.get('_id')
25 p.creation_date = pod_dict.get('creation_date')
26 p.name = pod_dict.get('name')
33 "creation_date": str(self.creation_date),
38 """ Describes a test project"""
43 self.description = None
44 self.creation_date = None
47 def testproject_from_dict(testproject_dict):
49 if testproject_dict is None:
53 t._id = testproject_dict.get('_id')
54 t.creation_date = testproject_dict.get('creation_date')
55 t.name = testproject_dict.get('name')
56 t.description = testproject_dict.get('description')
63 "description": self.description,
64 "creation_date": str(self.creation_date)
67 def format_http(self, test_cases=0):
71 "description": self.description,
72 "creation_date": str(self.creation_date),
73 "test_cases": test_cases
78 """ Describes a test case"""
83 self.project_name = None
84 self.description = None
85 self.creation_date = None
88 def test_case_from_dict(testcase_dict):
90 if testcase_dict is None:
94 t._id = testcase_dict.get('_id')
95 t.project_name = testcase_dict.get('project_name')
96 t.creation_date = testcase_dict.get('creation_date')
97 t.name = testcase_dict.get('name')
98 t.description = testcase_dict.get('description')
105 "description": self.description,
106 "project_name": self.project_name,
107 "creation_date": str(self.creation_date)
110 def format_http(self, test_project=None):
112 "_id": str(self._id),
114 "description": self.description,
115 "creation_date": str(self.creation_date),
117 if test_project is not None:
118 res["test_project"] = test_project
124 """ Describes a test result"""
128 self.case_name = None
129 self.project_name = None
131 self.installer = None
132 self.platform_version = None
133 self.description = None
134 self.creation_date = None
138 def test_result_from_dict(test_result_dict):
140 if test_result_dict is None:
144 t._id = test_result_dict.get('_id')
145 t.case_name = test_result_dict.get('case_name')
146 t.project_name = test_result_dict.get('project_name')
147 t.pod_id = test_result_dict.get('pod_id')
148 t.description = test_result_dict.get('description')
149 t.creation_date = str(test_result_dict.get('creation_date'))
150 t.details = test_result_dict.get('details')
156 "case_name": self.case_name,
157 "project_name": self.project_name,
158 "pod_id": self.pod_id,
159 "description": self.description,
160 "creation_date": str(self.creation_date),
161 "details": self.details,
164 def format_http(self):
166 "_id": str(self._id),
167 "case_name": self.case_name,
168 "project_name": self.project_name,
169 "pod_id": self.pod_id,
170 "description": self.description,
171 "creation_date": str(self.creation_date),
172 "details": self.details,