From 00fe5cd19e761086798dae0f9a83cd318764f9f1 Mon Sep 17 00:00:00 2001 From: Florian Aucomte Date: Mon, 29 Apr 2024 17:41:57 +0100 Subject: [PATCH] feat: Enable atomic transactions (#2288) --- example_project/portal_test_settings.py | 1 + example_project/settings.py | 1 + portal/tests/test_emails.py | 1 + 3 files changed, 3 insertions(+) diff --git a/example_project/portal_test_settings.py b/example_project/portal_test_settings.py index 9694f2036..38e232184 100644 --- a/example_project/portal_test_settings.py +++ b/example_project/portal_test_settings.py @@ -60,6 +60,7 @@ "NAME": os.path.join( os.path.abspath(os.path.dirname(__file__)), "db.sqlite3" ), # Or path to database file if using sqlite3. + "ATOMIC_REQUESTS": True, } } diff --git a/example_project/settings.py b/example_project/settings.py index 1b037b461..a088cc625 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -11,6 +11,7 @@ "NAME": os.path.join( os.path.abspath(os.path.dirname(__file__)), "db.sqlite3" ), # Or path to database file if using sqlite3. + "ATOMIC_REQUESTS": True, } } diff --git a/portal/tests/test_emails.py b/portal/tests/test_emails.py index 2ae890366..b48f5f2a9 100644 --- a/portal/tests/test_emails.py +++ b/portal/tests/test_emails.py @@ -59,6 +59,7 @@ def test_newsletter_calls_correct_requests(mocker, monkeypatch): mocked_add_to_address_book.assert_called_once() +@pytest.mark.django_db def test_newsletter_get_not_allowed(): c = Client()