Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-pettinga committed Jan 6, 2025
1 parent f4318ee commit 7c5c431
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 deletions.
15 changes: 15 additions & 0 deletions tests/test_frontend/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,18 @@ def mock_clean_document(self):
return original_clean_document(self)

monkeypatch.setattr(UploadDocumentsForm, "clean_document", mock_clean_document)


@pytest.fixture(autouse=True, scope="function")
def bypass_login(monkeypatch, test_apply_user):
"""Overrides the get_user function to always return the public user without authentication.
Effectively bypasses the login process for all frontend tests.
"""

def patched_get_user(request):
return test_apply_user

monkeypatch.setattr("django.contrib.auth.get_user", patched_get_user)

yield
16 changes: 0 additions & 16 deletions tests/test_frontend/test_apply_for_a_licence/conftest.py
Original file line number Diff line number Diff line change
@@ -1,16 +0,0 @@
import pytest


@pytest.fixture(autouse=True, scope="function")
def bypass_login(monkeypatch, test_apply_user):
"""Overrides the get_user function to always return the staff user without authentication.
Effectively bypasses the login process for all frontend tests.
"""

def patched_get_user(request):
return test_apply_user

monkeypatch.setattr("django.contrib.auth.get_user", patched_get_user)

yield
Empty file.
14 changes: 0 additions & 14 deletions tests/test_frontend/test_authentication/test_one_login.py

This file was deleted.

0 comments on commit 7c5c431

Please sign in to comment.