Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/tests #50

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion django_logging/middleware/request_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/email_notifier_fixture.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Generator
from typing import Generator, Tuple
from unittest.mock import MagicMock, patch

import pytest
Expand Down Expand Up @@ -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.

Expand Down
5 changes: 3 additions & 2 deletions tests/utils/test_email_notifier.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
import threading
from smtplib import SMTPException
from typing import Tuple
from unittest.mock import ANY, MagicMock

import pytest
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
Loading