diff options
Diffstat (limited to 'result_collection_api/tests/unit')
-rw-r--r-- | result_collection_api/tests/unit/test_base.py | 7 | ||||
-rw-r--r-- | result_collection_api/tests/unit/test_pod.py | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/result_collection_api/tests/unit/test_base.py b/result_collection_api/tests/unit/test_base.py index 99b1de2..16ed07c 100644 --- a/result_collection_api/tests/unit/test_base.py +++ b/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/result_collection_api/tests/unit/test_pod.py b/result_collection_api/tests/unit/test_pod.py index d7f4c3a..8a93027 100644 --- a/result_collection_api/tests/unit/test_pod.py +++ b/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) |