Skip to content

Commit 8ce34c5

Browse files
committed
chore: add ENABLE_SQS_MESSAGE_GROUP_IDS and test helper for message group id
1 parent 03dbe9e commit 8ce34c5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

app/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ class Config:
139139
# URL of redis instance
140140
REDIS_URL = os.getenv("REDIS_URL")
141141
REDIS_ENABLED = False if os.environ.get("REDIS_ENABLED") == "0" else True
142+
143+
ENABLE_SQS_MESSAGE_GROUP_IDS = os.environ.get("ENABLE_SQS_MESSAGE_GROUP_IDS", "1") == "1"
144+
142145
EXPIRE_CACHE_TEN_MINUTES = 600
143146
EXPIRE_CACHE_EIGHT_DAYS = 8 * 24 * 60 * 60
144147

@@ -587,6 +590,7 @@ class Development(Config):
587590
SERVER_NAME = os.getenv("SERVER_NAME")
588591

589592
REDIS_ENABLED = os.getenv("REDIS_ENABLED") == "1"
593+
ENABLE_SQS_MESSAGE_GROUP_IDS = os.environ.get("ENABLE_SQS_MESSAGE_GROUP_IDS", "1") == "1"
590594

591595
S3_BUCKET_CSV_UPLOAD = "development-notifications-csv-upload"
592596
S3_BUCKET_CONTACT_LIST = "development-contact-list"

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import subprocess
33
from collections import namedtuple
44
from contextlib import contextmanager
5+
from unittest.mock import patch
56
from urllib.parse import urlparse
67

78
import freezegun
@@ -265,6 +266,12 @@ def set_config_values(app, dict):
265266
app.config[key] = old_values[key]
266267

267268

269+
@contextmanager
270+
def _with_message_group_id(task, value):
271+
with patch("notifications_utils.celery.NotifyTask.message_group_id", new=value, create=True):
272+
yield
273+
274+
268275
class Matcher:
269276
def __init__(self, description, key):
270277
self.description = description

0 commit comments

Comments
 (0)