record soft deletion in audit log for applications and environments
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from atst.models import AuditEvent
|
||||
|
||||
from tests.factories import (
|
||||
ApplicationFactory,
|
||||
ApplicationRoleFactory,
|
||||
@@ -21,3 +23,18 @@ def test_application_environments_excludes_deleted():
|
||||
EnvironmentFactory.create(application=app, deleted=True)
|
||||
assert len(app.environments) == 1
|
||||
assert app.environments[0].id == env.id
|
||||
|
||||
|
||||
def test_audit_event_for_application_deletion(session):
|
||||
app = ApplicationFactory.create()
|
||||
app.deleted = True
|
||||
session.add(app)
|
||||
session.commit()
|
||||
|
||||
update_event = (
|
||||
session.query(AuditEvent)
|
||||
.filter(AuditEvent.resource_id == app.id, AuditEvent.action == "update")
|
||||
.one()
|
||||
)
|
||||
assert update_event.changed_state.get("deleted")
|
||||
assert update_event.changed_state["deleted"] == [False, True]
|
||||
|
Reference in New Issue
Block a user