workflow_test: make sure body is optional when testing SMS (#88473)

This commit is contained in:
Valentin Deniaud 2024-03-25 11:35:22 +01:00
parent 4d5b309986
commit 1bced18ab0
2 changed files with 7 additions and 1 deletions

View File

@ -636,6 +636,12 @@ def test_workflow_tests_sms(pub):
testdef = TestDef.create_from_formdata(formdef, formdata)
testdef.agent_id = user.id
testdef.workflow_tests.actions = [
workflow_tests.AssertSMS(),
]
testdef.run(formdef)
testdef.workflow_tests.actions = [
workflow_tests.AssertSMS(phone_numbers=['0123456789'], body='Hello'),
]

View File

@ -771,7 +771,7 @@ class AssertSMS(WorkflowTestAction):
details = [_('SMS phone numbers: %s') % ', '.join(sms['phone_numbers'])]
raise WorkflowTestError(_('SMS was not sent to %s.') % recipient, details=details)
if self.body != sms['body']:
if self.body and self.body != sms['body']:
details = [_('SMS body: "%s"') % sms['body']]
raise WorkflowTestError(_('SMS body mismatch.'), details=details)