workflow_tests: check all email recipients (#90035)
gitea/wcs/pipeline/head This commit looks good
Details
gitea/wcs/pipeline/head This commit looks good
Details
This commit is contained in:
parent
a2a4b1536b
commit
d8cb5e4737
|
@ -620,7 +620,7 @@ def test_workflow_tests_sendmail(mocked_send_email, pub):
|
|||
end_status = workflow.add_status(name='End status')
|
||||
|
||||
sendmail = new_status.add_action('sendmail')
|
||||
sendmail.to = ['test@example.org']
|
||||
sendmail.to = ['test@example.org', 'test2@example.org']
|
||||
sendmail.subject = 'In new status'
|
||||
sendmail.body = 'xxx'
|
||||
|
||||
|
@ -687,7 +687,7 @@ def test_workflow_tests_sendmail(mocked_send_email, pub):
|
|||
with pytest.raises(WorkflowTestError) as excinfo:
|
||||
testdef.run(formdef)
|
||||
assert str(excinfo.value) == 'Email was not sent to address "other@example.org".'
|
||||
assert 'Email addresses: test@example.org' in excinfo.value.details
|
||||
assert 'Email addresses: test2@example.org, test@example.org' in excinfo.value.details
|
||||
|
||||
testdef.workflow_tests.actions = [
|
||||
workflow_tests.ButtonClick(button_name='Go to end status'),
|
||||
|
|
|
@ -504,8 +504,8 @@ class AssertEmail(WorkflowTestAction):
|
|||
raise WorkflowTestError(_('No email was sent.'))
|
||||
|
||||
for address in self.addresses:
|
||||
details = [_('Email addresses: %s') % ', '.join(email.email_msg.to)]
|
||||
if address not in email.email_msg.to:
|
||||
details = [_('Email addresses: %s') % ', '.join(sorted(email.email_msg.recipients()))]
|
||||
if address not in email.email_msg.recipients():
|
||||
raise WorkflowTestError(_('Email was not sent to address "%s".') % address, details=details)
|
||||
|
||||
for subject in self.subject_strings:
|
||||
|
|
Loading…
Reference in New Issue