From 533e640ee68b1d5839f3b5385caf9b773083a6a0 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Thu, 26 May 2016 18:07:35 +0800 Subject: swagger-ize pod-apis of testAPI JIRA: FUNCTEST-263 Change-Id: I293e05f565f882ea39bbf6368405f10241269716 Signed-off-by: SerenaFeng --- result_collection_api/tests/unit/test_base.py | 7 ++++--- result_collection_api/tests/unit/test_pod.py | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'result_collection_api/tests/unit') 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) -- cgit 1.2.3-korg