Beispiel #1
0
    def test_je_cancel_delete_when_protected(self, get_je_p):

        job_exec = mock.Mock(id='123', tenant_id='tenant1', is_protected=True)
        get_je_p.return_value = job_exec

        with testtools.ExpectedException(ex.CancelingFailed):
            try:
                je.check_job_execution_cancel(job_exec)
            except ex.CancelingFailed as e:
                self.assert_protected_resource_exception(e)
                raise e

        with testtools.ExpectedException(ex.DeletionFailed):
            try:
                je.check_job_execution_delete(job_exec)
            except ex.DeletionFailed as e:
                self.assert_protected_resource_exception(e)
                raise e
Beispiel #2
0
    def test_public_je_cancel_delete_from_another_tenant(self, get_je_p):

        job_exec = mock.Mock(id="123", tenant_id="tenant2", is_protected=False, is_public=True)
        get_je_p.return_value = job_exec

        with testtools.ExpectedException(ex.CancelingFailed):
            try:
                je.check_job_execution_cancel(job_exec)
            except ex.CancelingFailed as e:
                self.assert_created_in_another_tenant_exception(e)
                raise e

        with testtools.ExpectedException(ex.DeletionFailed):
            try:
                je.check_job_execution_delete(job_exec)
            except ex.DeletionFailed as e:
                self.assert_created_in_another_tenant_exception(e)
                raise e
Beispiel #3
0
    def test_public_je_cancel_delete_from_another_tenant(self, get_je_p):

        job_exec = mock.Mock(id='123', tenant_id='tenant2', is_protected=False,
                             is_public=True)
        get_je_p.return_value = job_exec

        with testtools.ExpectedException(ex.CancelingFailed):
            try:
                je.check_job_execution_cancel(job_exec)
            except ex.CancelingFailed as e:
                self.assert_created_in_another_tenant_exception(e)
                raise e

        with testtools.ExpectedException(ex.DeletionFailed):
            try:
                je.check_job_execution_delete(job_exec)
            except ex.DeletionFailed as e:
                self.assert_created_in_another_tenant_exception(e)
                raise e