From bb323c5710018f24069b3d421b9a29fa734cc78c Mon Sep 17 00:00:00 2001 From: David O Neill Date: Thu, 14 Mar 2024 17:22:11 +0000 Subject: [PATCH] Loosen up body check on template https://github.com/ansible/awx/issues/14985 https://github.com/ansible/awx/issues/13983 --- awx/main/models/notifications.py | 2 +- awx_collection/test/awx/test_notification_template.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/main/models/notifications.py b/awx/main/models/notifications.py index 77f8032ce5eb..da03a7dd47f3 100644 --- a/awx/main/models/notifications.py +++ b/awx/main/models/notifications.py @@ -498,7 +498,7 @@ def build_notification_message(self, nt, status): # Body should have at least 2 CRLF, some clients will interpret # the email incorrectly with blank body. So we will check that - if len(body.strip().splitlines()) <= 2: + if len(body.strip().splitlines()) < 1: # blank body body = '\r\n'.join( [ diff --git a/awx_collection/test/awx/test_notification_template.py b/awx_collection/test/awx/test_notification_template.py index 346ac410583c..8bd2647b02fc 100644 --- a/awx_collection/test/awx/test_notification_template.py +++ b/awx_collection/test/awx/test_notification_template.py @@ -155,4 +155,4 @@ def test_build_notification_message_undefined(run_module, admin_user, organizati nt = NotificationTemplate.objects.get(id=result['id']) body = job.build_notification_message(nt, 'running') - assert 'The template rendering return a blank body' in body[1] + assert '{"started_by": "My Placeholder"}' in body[1]