diff options
author | Serena Feng <feng.xiaowei@zte.com.cn> | 2018-02-26 02:54:34 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-02-26 02:54:34 +0000 |
commit | 7ac324f4b4bb2d190bf0888d12054663e095cc77 (patch) | |
tree | cf38a4bbe0245e840befee5a7b7fabce52222f75 /testapi/opnfv_testapi/tests | |
parent | 9bd1b9da58c6fcceccf5bcc714d1bd99bc8f0dd6 (diff) | |
parent | 269a45a223c0b67972f3fe249fd2bbe2747dd70f (diff) |
Merge "prevent the delete/update for projects"
Diffstat (limited to 'testapi/opnfv_testapi/tests')
-rw-r--r-- | testapi/opnfv_testapi/tests/unit/handlers/test_project.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/testapi/opnfv_testapi/tests/unit/handlers/test_project.py b/testapi/opnfv_testapi/tests/unit/handlers/test_project.py index cbd1a4e..884dd68 100644 --- a/testapi/opnfv_testapi/tests/unit/handlers/test_project.py +++ b/testapi/opnfv_testapi/tests/unit/handlers/test_project.py @@ -12,6 +12,7 @@ import urllib from opnfv_testapi.common import message from opnfv_testapi.models import project_models +from opnfv_testapi.models import testcase_models as tcm from opnfv_testapi.tests.unit import executor from opnfv_testapi.tests.unit.handlers import test_base as base @@ -23,6 +24,9 @@ class TestProjectBase(base.TestBase): 'qtip-ssh test') self.req_e = project_models.ProjectCreateRequest('functest', 'functest test') + self.testcase_d = tcm.TestcaseCreateRequest.from_dict( + self.load_json('testcase_d')) + self.project = 'qtip' self.get_res = project_models.Project self.list_res = project_models.Projects self.update_res = project_models.Project @@ -150,6 +154,13 @@ class TestProjectUpdate(TestProjectBase): return self.req_d, self.req_d.name @executor.mock_valid_lfid() + @executor.update(httplib.UNAUTHORIZED, message.tied_with_resource()) + def test_updateNotAllowed(self): + self.create_help('/api/v1/projects/%s/cases', self.testcase_d, self.req_d.name) + req = project_models.ProjectUpdateRequest('apex', 'apex test') + return req, self.req_d.name + + @executor.mock_valid_lfid() @executor.update(httplib.OK, '_assert_update') def test_success(self): req = project_models.ProjectUpdateRequest('apex', 'apex test') @@ -178,6 +189,12 @@ class TestProjectDelete(TestProjectBase): return 'notFound' @executor.mock_valid_lfid() + @executor.delete(httplib.UNAUTHORIZED, message.tied_with_resource()) + def test_deleteNotAllowed(self): + self.create_help('/api/v1/projects/%s/cases', self.testcase_d, self.req_d.name) + return self.req_d.name + + @executor.mock_valid_lfid() @executor.delete(httplib.OK, '_assert_delete') def test_success(self): return self.req_d.name |