From 3a03a7efbdaf54fa5789c8d08119c7ac5b8f0a08 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Fri, 27 May 2016 16:55:17 +0800 Subject: swagger-ize testcase-apis of testAPI Change-Id: Ibe4b068fd667b796455be3fd4d9701d50879aace JIRA: FUNCTEST-266 Signed-off-by: SerenaFeng --- result_collection_api/tests/unit/test_testcase.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'result_collection_api/tests/unit/test_testcase.py') diff --git a/result_collection_api/tests/unit/test_testcase.py b/result_collection_api/tests/unit/test_testcase.py index 712a4e7..c6c0608 100644 --- a/result_collection_api/tests/unit/test_testcase.py +++ b/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) -- cgit 1.2.3-korg