From d319bdb626d5ab2943c6834e5d7ef0e6ce0506e5 Mon Sep 17 00:00:00 2001 From: Martin Riese Date: Thu, 12 Dec 2024 10:06:51 -0600 Subject: [PATCH] Shorten message since it is redundant --- corehq/apps/sms/models.py | 2 +- .../messaging/scheduling/scheduling_partitioned/models.py | 2 +- corehq/messaging/scheduling/tests/test_recipients.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/corehq/apps/sms/models.py b/corehq/apps/sms/models.py index b108e4dafc92..ec71762f0635 100644 --- a/corehq/apps/sms/models.py +++ b/corehq/apps/sms/models.py @@ -1131,7 +1131,7 @@ class MessagingEvent(models.Model, MessagingStatusMixin): ERROR_FCM_NO_ACTION: gettext_noop("No action selected for the FCM Data message type."), ERROR_FCM_NOTIFICATION_FAILURE: gettext_noop("Failure while sending FCM notifications to the devices."), ERROR_FCM_DOMAIN_NOT_ENABLED: gettext_noop("Domain is not enabled for FCM Push Notifications"), - FILTER_MISMATCH: gettext_noop("Recipient did not match filters") + FILTER_MISMATCH: gettext_noop("Recipient did not match filters:") } domain = models.CharField(max_length=126, null=False, db_index=True) diff --git a/corehq/messaging/scheduling/scheduling_partitioned/models.py b/corehq/messaging/scheduling/scheduling_partitioned/models.py index 948421b656c6..bcc9282b2b37 100644 --- a/corehq/messaging/scheduling/scheduling_partitioned/models.py +++ b/corehq/messaging/scheduling/scheduling_partitioned/models.py @@ -278,7 +278,7 @@ def _passes_user_data_filter(self, contact): actual_values_set = self.convert_to_set(user_data.get(key, "")) if actual_values_set.isdisjoint(allowed_values_set): - return False, (f"Filtered out on property {key}: " + return False, (f"{key}: " f"allowed: ({','.join(allowed_values_set)}), " f"found: ({','.join(actual_values_set)})") diff --git a/corehq/messaging/scheduling/tests/test_recipients.py b/corehq/messaging/scheduling/tests/test_recipients.py index 109c30a372d9..0dd62089560f 100644 --- a/corehq/messaging/scheduling/tests/test_recipients.py +++ b/corehq/messaging/scheduling/tests/test_recipients.py @@ -120,7 +120,7 @@ def test_fails_with_user_data_filter_because_value_does_not_match(self): passed, msg = (ScheduleInstance(domain=self.domain, schedule=schedule). _passes_user_data_filter(self.mobile_user)) self.assertFalse(passed) - self.assertEqual(msg, "Filtered out on property wants_email: allowed: (no), found: (yes)") + self.assertEqual(msg, "wants_email: allowed: (no), found: (yes)") def test_fails_with_user_data_filter_because_one_value_does_not_match(self): schedule = AlertSchedule() @@ -129,7 +129,7 @@ def test_fails_with_user_data_filter_because_one_value_does_not_match(self): passed, msg = (ScheduleInstance(domain=self.domain, schedule=schedule). _passes_user_data_filter(self.mobile_user)) self.assertFalse(passed) - self.assertEqual(msg, "Filtered out on property color: allowed: (red), found: (green)") + self.assertEqual(msg, "color: allowed: (red), found: (green)") def test_passes_with_user_case_filter(self): case = create_case_2(self.domain, case_type="thing", case_json={"case_color": "green"}) @@ -706,7 +706,7 @@ def handle_filtered_recipient(_, msg): self.user_ids(instance.expand_recipients(handle_filtered_recipient)), [self.mobile_user4.get_id, self.mobile_user5.get_id, self.mobile_user6.get_id] ) - self.assertEqual(message, "Filtered out on property role: allowed: (nurse), found: (pharmacist)") + self.assertEqual(message, "role: allowed: (nurse), found: (pharmacist)") self.assertEqual(2, filtered_count) def test_web_user_recipient_with_user_data_filter(self):