From 4973dd6bf642507541426cf6db934c41b61ee54b Mon Sep 17 00:00:00 2001 From: Jaewoo Park Date: Mon, 7 Nov 2016 13:16:31 -0800 Subject: [PATCH] Remove unused SUBMITTED audit state Submitted state is not referenced nor used in the Watcher codebase, and hence removed the references to the state from the codebase. Change-Id: Ibb0cf5125e2d93683739abf35030b7cf5cb1b056 Closes-Bug: 1634150 --- watcher/objects/audit.py | 1 - watcher/tests/api/v1/test_actions.py | 2 +- watcher/tests/api/v1/test_audit_templates.py | 2 +- watcher/tests/api/v1/test_audits.py | 6 +++--- watcher_tempest_plugin/tests/api/admin/test_audit.py | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/watcher/objects/audit.py b/watcher/objects/audit.py index f6ba5fbaf..839a263fb 100644 --- a/watcher/objects/audit.py +++ b/watcher/objects/audit.py @@ -60,7 +60,6 @@ from watcher.objects import utils as obj_utils class State(object): ONGOING = 'ONGOING' SUCCEEDED = 'SUCCEEDED' - SUBMITTED = 'SUBMITTED' FAILED = 'FAILED' CANCELLED = 'CANCELLED' DELETED = 'DELETED' diff --git a/watcher/tests/api/v1/test_actions.py b/watcher/tests/api/v1/test_actions.py index 3fb6751b3..1f6bafc27 100644 --- a/watcher/tests/api/v1/test_actions.py +++ b/watcher/tests/api/v1/test_actions.py @@ -445,7 +445,7 @@ class TestPatch(api_base.FunctionalTest): def test_patch_not_allowed(self, mock_utcnow): test_time = datetime.datetime(2000, 1, 1, 0, 0) mock_utcnow.return_value = test_time - new_state = objects.audit.State.SUBMITTED + new_state = objects.audit.State.SUCCEEDED response = self.get_json('/actions/%s' % self.action.uuid) self.assertNotEqual(new_state, response['state']) diff --git a/watcher/tests/api/v1/test_audit_templates.py b/watcher/tests/api/v1/test_audit_templates.py index d31b36cb9..20aeb7509 100644 --- a/watcher/tests/api/v1/test_audit_templates.py +++ b/watcher/tests/api/v1/test_audit_templates.py @@ -693,7 +693,7 @@ class TestAuaditTemplatePolicyEnforcement(api_base.FunctionalTest): self._common_policy_check( "audit_template:update", self.patch_json, '/audit_templates/%s' % audit_template.uuid, - [{'path': '/state', 'value': objects.audit.State.SUBMITTED, + [{'path': '/state', 'value': objects.audit.State.SUCCEEDED, 'op': 'replace'}], expect_errors=True) def test_policy_disallow_create(self): diff --git a/watcher/tests/api/v1/test_audits.py b/watcher/tests/api/v1/test_audits.py index d6e687f68..7d812fc9c 100644 --- a/watcher/tests/api/v1/test_audits.py +++ b/watcher/tests/api/v1/test_audits.py @@ -265,7 +265,7 @@ class TestPatch(api_base.FunctionalTest): test_time = datetime.datetime(2000, 1, 1, 0, 0) mock_utcnow.return_value = test_time - new_state = objects.audit.State.SUBMITTED + new_state = objects.audit.State.SUCCEEDED response = self.get_json('/audits/%s' % self.audit.uuid) self.assertNotEqual(new_state, response['state']) @@ -285,7 +285,7 @@ class TestPatch(api_base.FunctionalTest): def test_replace_non_existent_audit(self): response = self.patch_json( '/audits/%s' % utils.generate_uuid(), - [{'path': '/state', 'value': objects.audit.State.SUBMITTED, + [{'path': '/state', 'value': objects.audit.State.SUCCEEDED, 'op': 'replace'}], expect_errors=True) self.assertEqual(404, response.status_int) self.assertEqual('application/json', response.content_type) @@ -714,7 +714,7 @@ class TestAuaditPolicyEnforcement(api_base.FunctionalTest): self._common_policy_check( "audit:update", self.patch_json, '/audits/%s' % audit.uuid, - [{'path': '/state', 'value': objects.audit.State.SUBMITTED, + [{'path': '/state', 'value': objects.audit.State.SUCCEEDED, 'op': 'replace'}], expect_errors=True) def test_policy_disallow_create(self): diff --git a/watcher_tempest_plugin/tests/api/admin/test_audit.py b/watcher_tempest_plugin/tests/api/admin/test_audit.py index 10c5ad025..b175966c7 100644 --- a/watcher_tempest_plugin/tests/api/admin/test_audit.py +++ b/watcher_tempest_plugin/tests/api/admin/test_audit.py @@ -27,7 +27,7 @@ from watcher_tempest_plugin.tests.api.admin import base class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest): """Tests for audit.""" - audit_states = ['ONGOING', 'SUCCEEDED', 'SUBMITTED', 'FAILED', + audit_states = ['ONGOING', 'SUCCEEDED', 'FAILED', 'CANCELLED', 'DELETED', 'PENDING'] def assert_expected(self, expected, actual, @@ -152,7 +152,7 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest): class TestShowListAudit(base.BaseInfraOptimTest): """Tests for audit.""" - audit_states = ['ONGOING', 'SUCCEEDED', 'SUBMITTED', 'FAILED', + audit_states = ['ONGOING', 'SUCCEEDED', 'FAILED', 'CANCELLED', 'DELETED', 'PENDING'] @classmethod