Update to auditlog v3
This commit is contained in:
parent
6fb97321b4
commit
d4e3c0e1d7
8
Pipfile.lock
generated
8
Pipfile.lock
generated
@ -479,12 +479,12 @@
|
|||||||
},
|
},
|
||||||
"django-auditlog": {
|
"django-auditlog": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:7bc2c87e4aff62dec9785d1b2359a2b27148f8c286f8a52b9114fc7876c5a9f7",
|
"sha256:92db1cf4a51ceca5c26b3ff46997d9e3305a02da1bd435e2efb5b8b6d300ce1f",
|
||||||
"sha256:b9d3acebb64f3f2785157efe3f2f802e0929aafc579d85bbfb9827db4adab532"
|
"sha256:9de49f80a4911135d136017123cd73461f869b4947eec14d5e76db4b88182f3f"
|
||||||
],
|
],
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"markers": "python_version >= '3.7'",
|
"markers": "python_version >= '3.8'",
|
||||||
"version": "==2.3.0"
|
"version": "==3.0.0"
|
||||||
},
|
},
|
||||||
"django-celery-results": {
|
"django-celery-results": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
@ -4,6 +4,7 @@ import tempfile
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
from auditlog.context import disable_auditlog
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db import DatabaseError
|
from django.db import DatabaseError
|
||||||
@ -143,7 +144,9 @@ class TestFileHandling(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
|
|||||||
# Set a correspondent and save the document
|
# Set a correspondent and save the document
|
||||||
document.correspondent = Correspondent.objects.get_or_create(name="test")[0]
|
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()
|
m.side_effect = DatabaseError()
|
||||||
document.save()
|
document.save()
|
||||||
|
|
||||||
@ -557,6 +560,7 @@ class TestFileHandling(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
|
|||||||
@override_settings(FILENAME_FORMAT="{title}")
|
@override_settings(FILENAME_FORMAT="{title}")
|
||||||
@mock.patch("documents.signals.handlers.Document.objects.filter")
|
@mock.patch("documents.signals.handlers.Document.objects.filter")
|
||||||
def test_no_update_without_change(self, m):
|
def test_no_update_without_change(self, m):
|
||||||
|
with disable_auditlog():
|
||||||
doc = Document.objects.create(
|
doc = Document.objects.create(
|
||||||
title="document",
|
title="document",
|
||||||
filename="document.pdf",
|
filename="document.pdf",
|
||||||
|
@ -753,7 +753,7 @@ class DocumentViewSet(
|
|||||||
"id": entry.id,
|
"id": entry.id,
|
||||||
"timestamp": entry.timestamp,
|
"timestamp": entry.timestamp,
|
||||||
"action": entry.get_action_display(),
|
"action": entry.get_action_display(),
|
||||||
"changes": json.loads(entry.changes),
|
"changes": entry.changes,
|
||||||
"actor": (
|
"actor": (
|
||||||
{"id": entry.actor.id, "username": entry.actor.username}
|
{"id": entry.actor.id, "username": entry.actor.username}
|
||||||
if entry.actor
|
if entry.actor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user