diff options
Diffstat (limited to 'utils/test/result_collection_api/tests')
3 files changed, 23 insertions, 9 deletions
diff --git a/utils/test/result_collection_api/tests/unit/test_base.py b/utils/test/result_collection_api/tests/unit/test_base.py index 44e42b797..dfb2070c4 100644 --- a/utils/test/result_collection_api/tests/unit/test_base.py +++ b/utils/test/result_collection_api/tests/unit/test_base.py @@ -5,7 +5,8 @@ from tornado.testing import AsyncHTTPTestCase from resources.pod_handlers import PodCLHandler, PodGURHandler from resources.project_handlers import ProjectCLHandler, ProjectGURHandler from resources.handlers import VersionHandler, \ - TestcaseHandler, TestResultsHandler, DashboardHandler + TestResultsHandler, DashboardHandler +from resources.testcase_handlers import TestcaseCLHandler, TestcaseGURHandler from resources.models import CreateResponse import fake_pymongo @@ -32,8 +33,9 @@ class TestBase(AsyncHTTPTestCase): (r"/api/v1/pods/([^/]+)", PodGURHandler), (r"/api/v1/projects", ProjectCLHandler), (r"/api/v1/projects/([^/]+)", ProjectGURHandler), - (r"/api/v1/projects/([^/]+)/cases", TestcaseHandler), - (r"/api/v1/projects/([^/]+)/cases/([^/]+)", TestcaseHandler), + (r"/api/v1/projects/([^/]+)/cases", TestcaseCLHandler), + (r"/api/v1/projects/([^/]+)/cases/([^/]+)", + TestcaseGURHandler), (r"/api/v1/results", TestResultsHandler), (r"/api/v1/results([^/]*)", TestResultsHandler), (r"/api/v1/results/([^/]*)", TestResultsHandler), diff --git a/utils/test/result_collection_api/tests/unit/test_result.py b/utils/test/result_collection_api/tests/unit/test_result.py index 9c5093ed1..7dd07efa8 100644 --- a/utils/test/result_collection_api/tests/unit/test_result.py +++ b/utils/test/result_collection_api/tests/unit/test_result.py @@ -70,8 +70,8 @@ class TestResultBase(TestBase): self.basePath = '/api/v1/results' self.req_pod = PodCreateRequest(self.pod, 'metal', 'zte pod 1') self.req_project = ProjectCreateRequest(self.project, 'vping test') - self.req_testcase = TestcaseCreateRequest('/cases/vping', - self.case, + self.req_testcase = TestcaseCreateRequest(self.case, + '/cases/vping', 'vping-ssh test') self.create_help('/api/v1/pods', self.req_pod) self.create_help('/api/v1/projects', self.req_project) diff --git a/utils/test/result_collection_api/tests/unit/test_testcase.py b/utils/test/result_collection_api/tests/unit/test_testcase.py index 712a4e78c..c6c060802 100644 --- a/utils/test/result_collection_api/tests/unit/test_testcase.py +++ b/utils/test/result_collection_api/tests/unit/test_testcase.py @@ -14,11 +14,11 @@ __author__ = '__serena__' class TestCaseBase(TestBase): def setUp(self): super(TestCaseBase, self).setUp() - self.req_d = TestcaseCreateRequest('/cases/vping_1', - 'vping_1', + self.req_d = TestcaseCreateRequest('vping_1', + '/cases/vping_1', 'vping-ssh test') - self.req_e = TestcaseCreateRequest('/cases/doctor_1', - 'doctor_1', + self.req_e = TestcaseCreateRequest('doctor_1', + '/cases/doctor_1', 'create doctor') self.update_d = TestcaseUpdateRequest('vping_1', 'vping-ssh test', @@ -81,6 +81,18 @@ class TestCaseCreate(TestCaseBase): self.assertEqual(code, HTTP_FORBIDDEN) self.assertIn('Could not find project', body) + def test_emptyName(self): + req_empty = TestcaseCreateRequest('') + (code, body) = self.create(req_empty, self.project) + self.assertEqual(code, HTTP_BAD_REQUEST) + self.assertIn('testcase name missing', body) + + def test_noneName(self): + req_none = TestcaseCreateRequest(None) + (code, body) = self.create(req_none, self.project) + self.assertEqual(code, HTTP_BAD_REQUEST) + self.assertIn('testcase name missing', body) + def test_success(self): code, body = self.create_d() self.assertEqual(code, HTTP_OK) |