diff options
author | 2016-05-30 19:14:52 +0800 | |
---|---|---|
committer | 2016-05-30 20:05:11 +0800 | |
commit | 7358b5733d9e25f68b44b366ebe7714544b24c6c (patch) | |
tree | 4176ea8a20ce2239fb18c3490b3e41e34f88eef8 /result_collection_api/tests | |
parent | da918db679b094948cf95670f0fa74a4528ee336 (diff) |
swagger-ize dashboard and version apis of testAPI
JIRA: FUNCTEST-273
Change-Id: I6f2b1de5488ba684d0c00e9f40daee2487a011cc
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'result_collection_api/tests')
-rw-r--r-- | result_collection_api/tests/unit/test_base.py | 5 | ||||
-rw-r--r-- | result_collection_api/tests/unit/test_dashboard.py | 1 | ||||
-rw-r--r-- | result_collection_api/tests/unit/test_result.py | 23 |
3 files changed, 26 insertions, 3 deletions
diff --git a/result_collection_api/tests/unit/test_base.py b/result_collection_api/tests/unit/test_base.py index 036c6cf..ef711ae 100644 --- a/result_collection_api/tests/unit/test_base.py +++ b/result_collection_api/tests/unit/test_base.py @@ -1,12 +1,14 @@ import json + from tornado.web import Application from tornado.testing import AsyncHTTPTestCase from resources.pod_handlers import PodCLHandler, PodGURHandler from resources.project_handlers import ProjectCLHandler, ProjectGURHandler -from resources.handlers import VersionHandler, DashboardHandler +from resources.handlers import VersionHandler from resources.testcase_handlers import TestcaseCLHandler, TestcaseGURHandler from resources.result_handlers import ResultsCLHandler, ResultsGURHandler +from resources.dashboard_handlers import DashboardHandler from resources.models import CreateResponse import fake_pymongo @@ -39,7 +41,6 @@ class TestBase(AsyncHTTPTestCase): (r"/api/v1/results", ResultsCLHandler), (r"/api/v1/results/([^/]+)", ResultsGURHandler), (r"/dashboard/v1/results", DashboardHandler), - (r"/dashboard/v1/results([^/]*)", DashboardHandler), ], db=fake_pymongo, debug=True, diff --git a/result_collection_api/tests/unit/test_dashboard.py b/result_collection_api/tests/unit/test_dashboard.py index 5c3f924..3e71333 100644 --- a/result_collection_api/tests/unit/test_dashboard.py +++ b/result_collection_api/tests/unit/test_dashboard.py @@ -44,6 +44,7 @@ class TestDashboardQuery(TestDashboardBase): def test_success(self): code, body = self.query(self._set_query()) self.assertEqual(code, HTTP_OK) + print(body) self.assertIn('{"description": "vPing results for Dashboard"}', body) def test_caseIsStatus(self): diff --git a/result_collection_api/tests/unit/test_result.py b/result_collection_api/tests/unit/test_result.py index 5757df0..a7541b3 100644 --- a/result_collection_api/tests/unit/test_result.py +++ b/result_collection_api/tests/unit/test_result.py @@ -1,4 +1,5 @@ import unittest +import copy from test_base import TestBase from resources.pod_models import PodCreateRequest @@ -8,7 +9,6 @@ from resources.result_models import ResultCreateRequest, \ TestResult, TestResults from common.constants import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND - __author__ = '__serena__' @@ -154,6 +154,27 @@ class TestResultCreate(TestResultBase): self.assertEqual(code, HTTP_OK) self.assert_href(body) + def test_createSameResults(self): + # req_again = ResultCreateRequest(pod_name=self.pod, + # project_name=self.project, + # case_name=self.case, + # installer=self.installer, + # version=self.version, + # start_date="2016-05-23 08:16:09.477097", + # stop_date=self.stop_date, + # details=self.details.format(), + # build_tag=self.build_tag, + # scenario=self.scenario, + # criteria=self.criteria, + # trust_indicator=self.trust_indicator) + req_again = copy.deepcopy(self.req_d) + req_again.start_date = "2016-05-23 08:16:09.477097" + req_again.stop_date = "2016-05-23 08:16:19.477097" + + (code, body) = self.create(req_again) + self.assertEqual(code, HTTP_OK) + self.assert_href(body) + class TestResultGet(TestResultBase): def test_getOne(self): |