diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-05-26 20:32:02 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-05-26 20:40:13 +0800 |
commit | 5362ddab5a739f5198d3e7918b6059c27a4eac09 (patch) | |
tree | b46c54b17c561cf051bf79717b3a24c8eb138b5a /utils/test/result_collection_api/tests/unit | |
parent | 00355a8df9949edc12c41d5a8475fc17efbb03d3 (diff) |
swagger-ize project-apis of testAPI
rename pod_handler.py to pod_handlers.py
JIRA: FUNCTEST-264
Change-Id: I8699999776bdb238f680a128b83cea0a098534c5
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/result_collection_api/tests/unit')
-rw-r--r-- | utils/test/result_collection_api/tests/unit/test_base.py | 9 | ||||
-rw-r--r-- | utils/test/result_collection_api/tests/unit/test_project.py | 12 |
2 files changed, 17 insertions, 4 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 16ed07c9c..44e42b797 100644 --- a/utils/test/result_collection_api/tests/unit/test_base.py +++ b/utils/test/result_collection_api/tests/unit/test_base.py @@ -2,9 +2,10 @@ import json from tornado.web import Application from tornado.testing import AsyncHTTPTestCase -from resources.pod_handler import PodCLHandler, PodGURHandler +from resources.pod_handlers import PodCLHandler, PodGURHandler +from resources.project_handlers import ProjectCLHandler, ProjectGURHandler from resources.handlers import VersionHandler, \ - ProjectHandler, TestcaseHandler, TestResultsHandler, DashboardHandler + TestcaseHandler, TestResultsHandler, DashboardHandler from resources.models import CreateResponse import fake_pymongo @@ -29,8 +30,8 @@ class TestBase(AsyncHTTPTestCase): (r"/versions", VersionHandler), (r"/api/v1/pods", PodCLHandler), (r"/api/v1/pods/([^/]+)", PodGURHandler), - (r"/api/v1/projects", ProjectHandler), - (r"/api/v1/projects/([^/]+)", ProjectHandler), + (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/results", TestResultsHandler), diff --git a/utils/test/result_collection_api/tests/unit/test_project.py b/utils/test/result_collection_api/tests/unit/test_project.py index c38078098..b07cb7ad6 100644 --- a/utils/test/result_collection_api/tests/unit/test_project.py +++ b/utils/test/result_collection_api/tests/unit/test_project.py @@ -30,6 +30,18 @@ class TestProjectCreate(TestProjectBase): (code, body) = self.create() self.assertEqual(code, HTTP_BAD_REQUEST) + def test_emptyName(self): + req_empty = ProjectCreateRequest('') + (code, body) = self.create(req_empty) + self.assertEqual(code, HTTP_BAD_REQUEST) + self.assertIn('project name missing', body) + + def test_noneName(self): + req_none = ProjectCreateRequest(None) + (code, body) = self.create(req_none) + self.assertEqual(code, HTTP_BAD_REQUEST) + self.assertIn('project name missing', body) + def test_success(self): (code, body) = self.create_d() self.assertEqual(code, HTTP_OK) |