From a32a2f58e2a5c8d1c2874396e146c9965f69ba6c Mon Sep 17 00:00:00 2001 From: vincent porte Date: Thu, 19 Dec 2024 10:59:30 +0100 Subject: [PATCH] =?UTF-8?q?this=20is=20just=20WIP,=20waiting=20for=20a=20P?= =?UTF-8?q?R=C2=A0on=20test.py=20isolation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/settings/test.py | 12 ++++++------ lacommunaute/notification/tasks.py | 6 +++--- pyproject.toml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config/settings/test.py b/config/settings/test.py index 373d288c..e14a5b49 100644 --- a/config/settings/test.py +++ b/config/settings/test.py @@ -7,10 +7,10 @@ SECRET_KEY = "jumpinjackflash" -DEBUG = False +DEBUG = True ENVIRONMENT = Environment.DEV ALLOWED_HOSTS = [] -COMPRESS_ENABLED = False +# COMPRESS_ENABLED = False # Database # ------------------------------------------------------------------------------ @@ -34,13 +34,13 @@ # ProConnect # ------------------------------------------------------------------------------ -OPENID_CONNECT_BASE_URL = os.getenv("OPENID_CONNECT_BASE_URL", "http://127.0.0.1:8080") -OPENID_CONNECT_CLIENT_ID = os.getenv("OPENID_CONNECT_CLIENT_ID", "local_openid_connect") -OPENID_CONNECT_CLIENT_SECRET = os.getenv("OPENID_CONNECT_CLIENT_SECRET", "password") +# OPENID_CONNECT_BASE_URL = os.getenv("OPENID_CONNECT_BASE_URL", "http://127.0.0.1:8080") +# OPENID_CONNECT_CLIENT_ID = os.getenv("OPENID_CONNECT_CLIENT_ID", "local_openid_connect") +# OPENID_CONNECT_CLIENT_SECRET = os.getenv("OPENID_CONNECT_CLIENT_SECRET", "password") # SENDINBLUE / BREVO # --------------------------------------- SIB_URL = os.getenv("SIB_URL", "https://test.com") SIB_SMTP_URL = urljoin(SIB_URL, "smtp/email") SIB_CONTACTS_URL = urljoin(SIB_URL, "contacts/import") -SIB_API_KEY = os.getenv("SIB_API_KEY", "key_to_be_set") +# SIB_API_KEY = os.getenv("SIB_API_KEY", "key_to_be_set") diff --git a/lacommunaute/notification/tasks.py b/lacommunaute/notification/tasks.py index c8237e32..428a4c47 100644 --- a/lacommunaute/notification/tasks.py +++ b/lacommunaute/notification/tasks.py @@ -1,9 +1,9 @@ +# from config.settings.base import NEW_MESSAGES_EMAIL_MAX_PREVIEW, SIB_NEW_MESSAGES_TEMPLATE from django.conf import settings from django.template.defaultfilters import pluralize from django.urls import reverse from django.utils import timezone -from config.settings.base import NEW_MESSAGES_EMAIL_MAX_PREVIEW, SIB_NEW_MESSAGES_TEMPLATE from lacommunaute.forum_conversation.models import Topic from lacommunaute.forum_member.shortcuts import get_forum_member_display_name from lacommunaute.notification.emails import bulk_send_user_to_list, send_email @@ -31,13 +31,13 @@ def get_grouped_notifications(): params = { "email_thumbnail": (f"Vous avez {message_count_text} à découvrir sur la communauté de l'inclusion"), - "messages": get_serialized_messages(recipient_notifications[:NEW_MESSAGES_EMAIL_MAX_PREVIEW]), + "messages": get_serialized_messages(recipient_notifications[: settings.NEW_MESSAGES_EMAIL_MAX_PREVIEW]), } send_email( to=[{"email": recipient}], params=params, kind=EmailSentTrackKind.BULK_NOTIFS, - template_id=SIB_NEW_MESSAGES_TEMPLATE, + template_id=settings.SIB_NEW_MESSAGES_TEMPLATE, ) notifications.update(sent_at=timezone.now()) diff --git a/pyproject.toml b/pyproject.toml index ac170ac2..442460b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -90,7 +90,7 @@ format_js = false [tool.pytest.ini_options] DJANGO_SETTINGS_MODULE = "config.settings.test" -FAIL_INVALID_TEMPLATE_VARS = true +# FAIL_INVALID_TEMPLATE_VARS = true python_files = ["tests*.py", "test_*.py"] addopts = [ "--reuse-db",