Skip to content

Commit

Permalink
Added test for new setting
Browse files Browse the repository at this point in the history
  • Loading branch information
dferens authored and jheld committed Apr 19, 2023
1 parent 2df2f47 commit fc50e33
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion easyaudit/tests/test_app/tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import json
import re
from unittest import skip, skipIf
from unittest import skip, skipIf, mock

import django

Expand Down Expand Up @@ -124,6 +124,17 @@ def test_delete(self):
crud_event_qs = CRUDEvent.objects.filter(object_id=obj_id, content_type=ContentType.objects.get_for_model(obj))
self.assertEqual(2, crud_event_qs.count())

@mock.patch('easyaudit.signals.model_signals.audit_logger')
def test_propagate_exceptions(self, mocked_audit_logger):
mocked_audit_logger.crud.side_effect = ValueError

# By default, it should catch exceptions
_ = self.Model.objects.create()

with override_settings(DJANGO_EASY_AUDIT_PROPAGATE_EXCEPTIONS=True):
with self.assertRaises(ValueError):
_ = self.Model.objects.create()


class TestAuditUUIDModels(TestAuditModels):
Model = TestUUIDModel
Expand Down

0 comments on commit fc50e33

Please sign in to comment.