summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py
diff options
context:
space:
mode:
authorthuva4 <tharma.thuva@gmail.com>2018-02-26 09:48:45 +0530
committerthuva4 <tharma.thuva@gmail.com>2018-03-01 12:29:16 +0530
commit4aa95918da586d3c1f9bf19a19c5cd55541c38d0 (patch)
treef822c1c3c658b9b76ecc8cf89bbfe53e8d850c7f /testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py
parent7ac324f4b4bb2d190bf0888d12054663e095cc77 (diff)
Prevent to delete the pods
Do not allow to delete pods which are associated with test-results JIRA: RELENG-350 Change-Id: I8cb306d719acebff257048f08bcb981d81c64513 Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py')
-rw-r--r--testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py b/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py
index 9a2bf58..78f3ab1 100644
--- a/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py
+++ b/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py
@@ -10,6 +10,7 @@ import httplib
from opnfv_testapi.common import message
from opnfv_testapi.models import testcase_models as tcm
+from opnfv_testapi.models import result_models as rm
from opnfv_testapi.tests.unit import executor
from opnfv_testapi.tests.unit import fake_pymongo
from opnfv_testapi.tests.unit.handlers import test_base as base
@@ -32,6 +33,8 @@ class TestCaseBase(base.TestBase):
self.basePath = '/api/v1/projects/%s/cases'
fake_pymongo.projects.insert(self.project_e.format())
print self.req_d.format()
+ self.results_d = rm.ResultCreateRequest.from_dict(
+ self.load_json('test_result'))
def assert_body(self, case, req=None):
if not req:
@@ -176,11 +179,20 @@ class TestCaseDelete(TestCaseBase):
def setUp(self):
super(TestCaseDelete, self).setUp()
self.create_d()
+ fake_pymongo.pods.insert(self.pod_d.format())
+ fake_pymongo.projects.insert({'name': self.results_d.project_name})
+ fake_pymongo.testcases.insert({'name': self.results_d.case_name,
+ 'project_name': self.results_d.project_name})
@executor.delete(httplib.NOT_FOUND, message.not_found_base)
def test_notFound(self):
return 'notFound'
+ @executor.delete(httplib.UNAUTHORIZED, message.tied_with_resource())
+ def test_deleteNotAllowed(self):
+ print self.create_help('/api/v1/results', self.results_d)
+ return self.results_d.case_name
+
@executor.delete(httplib.OK, '_delete_success')
def test_success(self):
return self.req_d.name