From e06bdb148bca4f89f2666833f0f7949a48f77559 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Thu, 6 Apr 2017 16:59:19 +0800 Subject: change not_found to forbidden when db not exist Change-Id: I1aa61c5d1b057b5a53cf6369b26605867a4d092e Signed-off-by: SerenaFeng --- utils/test/testapi/opnfv_testapi/resources/result_handlers.py | 6 +++--- utils/test/testapi/opnfv_testapi/tests/unit/test_result.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py index 609c5ce20..fb5ed9ec7 100644 --- a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py @@ -145,20 +145,20 @@ class ResultsCLHandler(GenericResultHandler): return {'name': data.pod_name} def pod_error(data): - return httplib.NOT_FOUND, message.not_found('pod', data.pod_name) + return httplib.FORBIDDEN, message.not_found('pod', data.pod_name) def project_query(data): return {'name': data.project_name} def project_error(data): - return httplib.NOT_FOUND, message.not_found('project', + return httplib.FORBIDDEN, message.not_found('project', data.project_name) def testcase_query(data): return {'project_name': data.project_name, 'name': data.case_name} def testcase_error(data): - return httplib.NOT_FOUND, message.not_found('testcase', + return httplib.FORBIDDEN, message.not_found('testcase', data.case_name) miss_checks = ['pod_name', 'project_name', 'case_name'] diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py index ae78237e5..2e0aa3685 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py @@ -163,21 +163,21 @@ class TestResultCreate(TestResultBase): req = self.req_d req.pod_name = 'notExistPod' (code, body) = self.create(req) - self.assertEqual(code, httplib.NOT_FOUND) + self.assertEqual(code, httplib.FORBIDDEN) self.assertIn(message.not_found_base, body) def test_noProject(self): req = self.req_d req.project_name = 'notExistProject' (code, body) = self.create(req) - self.assertEqual(code, httplib.NOT_FOUND) + self.assertEqual(code, httplib.FORBIDDEN) self.assertIn(message.not_found_base, body) def test_noTestcase(self): req = self.req_d req.case_name = 'notExistTestcase' (code, body) = self.create(req) - self.assertEqual(code, httplib.NOT_FOUND) + self.assertEqual(code, httplib.FORBIDDEN) self.assertIn(message.not_found_base, body) def test_success(self): -- cgit 1.2.3-korg