diff --git a/Pipfile.lock b/Pipfile.lock index da4a08ea0..bd641aa43 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -479,12 +479,12 @@ }, "django-auditlog": { "hashes": [ - "sha256:7bc2c87e4aff62dec9785d1b2359a2b27148f8c286f8a52b9114fc7876c5a9f7", - "sha256:b9d3acebb64f3f2785157efe3f2f802e0929aafc579d85bbfb9827db4adab532" + "sha256:92db1cf4a51ceca5c26b3ff46997d9e3305a02da1bd435e2efb5b8b6d300ce1f", + "sha256:9de49f80a4911135d136017123cd73461f869b4947eec14d5e76db4b88182f3f" ], "index": "pypi", - "markers": "python_version >= '3.7'", - "version": "==2.3.0" + "markers": "python_version >= '3.8'", + "version": "==3.0.0" }, "django-celery-results": { "hashes": [ diff --git a/src/documents/tests/test_file_handling.py b/src/documents/tests/test_file_handling.py index a924e377b..fe5a5b589 100644 --- a/src/documents/tests/test_file_handling.py +++ b/src/documents/tests/test_file_handling.py @@ -4,6 +4,7 @@ import tempfile from pathlib import Path from unittest import mock +from auditlog.context import disable_auditlog from django.conf import settings from django.contrib.auth.models import User from django.db import DatabaseError @@ -143,7 +144,9 @@ class TestFileHandling(DirectoriesMixin, FileSystemAssertsMixin, TestCase): # Set a correspondent and save the document document.correspondent = Correspondent.objects.get_or_create(name="test")[0] - with mock.patch("documents.signals.handlers.Document.objects.filter") as m: + with mock.patch( + "documents.signals.handlers.Document.objects.filter", + ) as m, disable_auditlog(): m.side_effect = DatabaseError() document.save() @@ -557,20 +560,21 @@ class TestFileHandling(DirectoriesMixin, FileSystemAssertsMixin, TestCase): @override_settings(FILENAME_FORMAT="{title}") @mock.patch("documents.signals.handlers.Document.objects.filter") def test_no_update_without_change(self, m): - doc = Document.objects.create( - title="document", - filename="document.pdf", - archive_filename="document.pdf", - checksum="A", - archive_checksum="B", - mime_type="application/pdf", - ) - Path(doc.source_path).touch() - Path(doc.archive_path).touch() + with disable_auditlog(): + doc = Document.objects.create( + title="document", + filename="document.pdf", + archive_filename="document.pdf", + checksum="A", + archive_checksum="B", + mime_type="application/pdf", + ) + Path(doc.source_path).touch() + Path(doc.archive_path).touch() - doc.save() + doc.save() - m.assert_not_called() + m.assert_not_called() class TestFileHandlingWithArchive(DirectoriesMixin, FileSystemAssertsMixin, TestCase): diff --git a/src/documents/views.py b/src/documents/views.py index 9504aabe7..27872f93e 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -753,7 +753,7 @@ class DocumentViewSet( "id": entry.id, "timestamp": entry.timestamp, "action": entry.get_action_display(), - "changes": json.loads(entry.changes), + "changes": entry.changes, "actor": ( {"id": entry.actor.id, "username": entry.actor.username} if entry.actor