summaryrefslogtreecommitdiffstats
path: root/utils/test/result_collection_api/resources/models.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-05-20 18:00:52 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-05-20 18:11:04 +0800
commiteb168d7608278b670b3178099766ef0c78d3d85a (patch)
tree39c8eb251bf39b9dc3a5d480dfd3f7c6b23d734b /utils/test/result_collection_api/resources/models.py
parent0fb2530a0e88a08e9d77a23073b3cd576ce6e47f (diff)
add unittests for testcase and refactor testcase related implementation
modification: add unittests for testcase refactor testcase table name in db to testcases refactor response body fix some bugs JIRA:FUNCTEST-254 Change-Id: Ia7c7101fa742af82bfc8c4a3d398a7dad601bca1 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/result_collection_api/resources/models.py')
-rw-r--r--utils/test/result_collection_api/resources/models.py51
1 files changed, 1 insertions, 50 deletions
diff --git a/utils/test/result_collection_api/resources/models.py b/utils/test/result_collection_api/resources/models.py
index 56530e827..b919d9e54 100644
--- a/utils/test/result_collection_api/resources/models.py
+++ b/utils/test/result_collection_api/resources/models.py
@@ -10,6 +10,7 @@
# 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
##############################################################################
@@ -30,56 +31,6 @@ class CreateResponse(object):
return {'href': self.href}
-class TestCase:
- """ Describes a test case"""
-
- def __init__(self):
- self._id = None
- self.name = None
- self.project_name = None
- self.description = None
- self.url = None
- self.creation_date = None
-
- @staticmethod
- def test_case_from_dict(testcase_dict):
-
- if testcase_dict is None:
- return None
-
- t = TestCase()
- t._id = testcase_dict.get('_id')
- t.project_name = testcase_dict.get('project_name')
- t.creation_date = testcase_dict.get('creation_date')
- t.name = testcase_dict.get('name')
- t.description = testcase_dict.get('description')
- t.url = testcase_dict.get('url')
-
- return t
-
- def format(self):
- return {
- "name": self.name,
- "description": self.description,
- "project_name": self.project_name,
- "creation_date": str(self.creation_date),
- "url": self.url
- }
-
- def format_http(self, test_project=None):
- res = {
- "_id": str(self._id),
- "name": self.name,
- "description": self.description,
- "creation_date": str(self.creation_date),
- "url": self.url,
- }
- if test_project is not None:
- res["test_project"] = test_project
-
- return res
-
-
class TestResult:
""" Describes a test result"""