diff options
author | 2016-05-26 18:07:35 +0800 | |
---|---|---|
committer | 2016-05-26 18:17:41 +0800 | |
commit | 00355a8df9949edc12c41d5a8475fc17efbb03d3 (patch) | |
tree | 55a3d1a807882e8d1294f66ef248f923b3ffe6ae /utils/test/result_collection_api/tests/unit | |
parent | a7d4197cef093a5eae141efa34c0833c76a1f183 (diff) |
swagger-ize pod-apis of testAPI
JIRA: FUNCTEST-263
Change-Id: I293e05f565f882ea39bbf6368405f10241269716
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 | 7 | ||||
-rw-r--r-- | utils/test/result_collection_api/tests/unit/test_pod.py | 12 |
2 files changed, 16 insertions, 3 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 99b1de286..16ed07c9c 100644 --- a/utils/test/result_collection_api/tests/unit/test_base.py +++ b/utils/test/result_collection_api/tests/unit/test_base.py @@ -2,7 +2,8 @@ import json from tornado.web import Application from tornado.testing import AsyncHTTPTestCase -from resources.handlers import VersionHandler, PodHandler, \ +from resources.pod_handler import PodCLHandler, PodGURHandler +from resources.handlers import VersionHandler, \ ProjectHandler, TestcaseHandler, TestResultsHandler, DashboardHandler from resources.models import CreateResponse import fake_pymongo @@ -26,8 +27,8 @@ class TestBase(AsyncHTTPTestCase): return Application( [ (r"/versions", VersionHandler), - (r"/api/v1/pods", PodHandler), - (r"/api/v1/pods/([^/]+)", PodHandler), + (r"/api/v1/pods", PodCLHandler), + (r"/api/v1/pods/([^/]+)", PodGURHandler), (r"/api/v1/projects", ProjectHandler), (r"/api/v1/projects/([^/]+)", ProjectHandler), (r"/api/v1/projects/([^/]+)/cases", TestcaseHandler), diff --git a/utils/test/result_collection_api/tests/unit/test_pod.py b/utils/test/result_collection_api/tests/unit/test_pod.py index d7f4c3a63..8a9302738 100644 --- a/utils/test/result_collection_api/tests/unit/test_pod.py +++ b/utils/test/result_collection_api/tests/unit/test_pod.py @@ -32,6 +32,18 @@ class TestPodCreate(TestPodBase): (code, body) = self.create() self.assertEqual(code, HTTP_BAD_REQUEST) + def test_emptyName(self): + req_empty = PodCreateRequest('') + (code, body) = self.create(req_empty) + self.assertEqual(code, HTTP_BAD_REQUEST) + self.assertIn('pod name missing', body) + + def test_noneName(self): + req_none = PodCreateRequest(None) + (code, body) = self.create(req_none) + self.assertEqual(code, HTTP_BAD_REQUEST) + self.assertIn('pod name missing', body) + def test_success(self): code, body = self.create_d() self.assertEqual(code, HTTP_OK) |