From fc8b7c60ffda5461a80c28f09e3d661307702363 Mon Sep 17 00:00:00 2001 From: Johanna England Date: Wed, 15 Nov 2023 11:19:32 +0100 Subject: [PATCH] Use admin account fixture in alert profile tests --- tests/integration/web/alertprofiles_test.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/integration/web/alertprofiles_test.py b/tests/integration/web/alertprofiles_test.py index 3252ec75ef..47fa1dfcad 100644 --- a/tests/integration/web/alertprofiles_test.py +++ b/tests/integration/web/alertprofiles_test.py @@ -23,10 +23,10 @@ from nav.web.alertprofiles.views import set_active_profile -def test_profile_with_nonascii_name_should_be_saved(db): +def test_profile_with_nonascii_name_should_be_saved(db, admin_account): factory = RequestFactory() request = factory.get(reverse('alertprofiles-profile-save')) - request.account = Account.objects.get(pk=Account.ADMIN_ACCOUNT) + request.account = admin_account request.session = MagicMock() profile = AlertProfile(account=request.account, name=u'ÆØÅ') profile.save() @@ -629,8 +629,8 @@ def test_alertprofiles_remove_filter_group(db, client, dummy_filter_group): @pytest.fixture(scope='function') -def dummy_profile(): - account = Account.objects.get(id=Account.ADMIN_ACCOUNT) +def dummy_profile(admin_account): + account = admin_account profile = AlertProfile(account=account, name=u'ÆØÅ Profile %d' % randint(1, 1000)) profile.save() return profile @@ -646,8 +646,8 @@ def activated_dummy_profile(dummy_profile): @pytest.fixture(scope="function") -def dummy_filter(): - filtr = Filter(name="dummy", owner=Account.objects.get(id=Account.ADMIN_ACCOUNT)) +def dummy_filter(admin_account): + filtr = Filter(name="dummy", owner=admin_account) filtr.save() return filtr