Skip to content

Commit

Permalink
fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
hugobessa committed Dec 4, 2024
1 parent 85aff18 commit 7b58a75
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions vintasend_celery/tests/test_services/test_adapters.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import uuid
from unittest import TestCase
from unittest.mock import patch
import pytest

from celery import Celery # type: ignore
from vintasend.constants import NotificationStatus, NotificationTypes
from vintasend.exceptions import NotificationSendError
from vintasend.services.dataclasses import Notification
from vintasend.services.notification_backends.stubs.fake_backend import FakeFileBackend
from vintasend.services.notification_template_renderers.stubs.fake_templated_email_renderer import FakeTemplateRenderer, FakeTemplateRendererWithException
from vintasend.services.notification_template_renderers.stubs.fake_templated_email_renderer import (
FakeTemplateRenderer, FakeTemplateRendererWithException
)
from vintasend.services.notification_service import NotificationService, register_context
from vintasend_celery.services.notification_adapters.celery_adapter_factory import (
CeleryNotificationAdapter
Expand All @@ -30,12 +30,18 @@ class AsyncCeleryFakeEmailAdapter(
class AsyncCeleryFakeEmailAdapterTestCase(TestCase):
def setUp(self):
celery_app.conf.update(task_always_eager=True)
self.backend = FakeFileBackend(database_file_name="celery-adapter-tests-notifications.json")
self.backend = FakeFileBackend(
database_file_name="celery-adapter-tests-notifications.json"
)

self.renderer = FakeTemplateRenderer()
self.async_adapter = AsyncCeleryFakeEmailAdapter(template_renderer=self.renderer, backend=self.backend)
self.async_adapter = AsyncCeleryFakeEmailAdapter(
template_renderer=self.renderer, backend=self.backend
)

self.notification_service = NotificationService[AsyncCeleryFakeEmailAdapter, FakeFileBackend](
self.notification_service = NotificationService[
AsyncCeleryFakeEmailAdapter, FakeFileBackend
](
[self.async_adapter],
self.backend,
)
Expand Down Expand Up @@ -90,7 +96,9 @@ def test_send_notification_with_render_error(self):
self.backend.notifications.append(notification)
self.backend._store_notifications()

with patch("vintasend_celery.services.notification_adapters.celery_adapter_factory.logger.exception") as mock_log_exception:
with patch(
"vintasend_celery.services.notification_adapters.celery_adapter_factory.logger.exception"
) as mock_log_exception:
notification_service.send(notification)

mock_log_exception.assert_called_once()
Expand Down

0 comments on commit 7b58a75

Please sign in to comment.