diff --git a/django_logging/middleware/request_middleware.py b/django_logging/middleware/request_middleware.py index ba3168a..cd5e8ed 100644 --- a/django_logging/middleware/request_middleware.py +++ b/django_logging/middleware/request_middleware.py @@ -56,7 +56,7 @@ def __call__(self, request: HttpRequest) -> HttpResponse: request.browser_type = user_agent logger.info( - "Request Info: (request_path: %s, user: %s," "\nIP: %s, user_agent: %s)", + "Request Info: (request_path: %s, user: %s,\n IP: %s, user_agent: %s)", request.path, user, ip_address, diff --git a/tests/fixtures/email_notifier_fixture.py b/tests/fixtures/email_notifier_fixture.py index 4f3570c..642cc96 100644 --- a/tests/fixtures/email_notifier_fixture.py +++ b/tests/fixtures/email_notifier_fixture.py @@ -1,4 +1,4 @@ -from typing import Generator +from typing import Generator, Tuple from unittest.mock import MagicMock, patch import pytest @@ -46,7 +46,7 @@ def email_mock_settings() -> Generator[MagicMock, None, None]: @pytest.fixture -def notifier_mock_logger() -> Generator[tuple[MagicMock, MagicMock], None, None]: +def notifier_mock_logger() -> Generator[Tuple[MagicMock, MagicMock], None, None]: """ Fixture to mock the logger used for logging messages. diff --git a/tests/utils/test_email_notifier.py b/tests/utils/test_email_notifier.py index 1cabca8..1efd5ee 100644 --- a/tests/utils/test_email_notifier.py +++ b/tests/utils/test_email_notifier.py @@ -1,6 +1,7 @@ import sys import threading from smtplib import SMTPException +from typing import Tuple from unittest.mock import ANY, MagicMock import pytest @@ -21,7 +22,7 @@ def test_send_email_async_success( self, mock_smtp: MagicMock, email_mock_settings: MagicMock, - notifier_mock_logger: tuple[MagicMock, MagicMock], + notifier_mock_logger: Tuple[MagicMock, MagicMock], ) -> None: """ Test that the send_email_async function successfully sends an email. @@ -91,7 +92,7 @@ def test_send_email_async_failure( self, mock_smtp: MagicMock, email_mock_settings: MagicMock, - notifier_mock_logger: tuple[MagicMock, MagicMock], + notifier_mock_logger: Tuple[MagicMock, MagicMock], ) -> None: """ Test that the send_email_async function handles SMTP failures.