2020-12-06 15:22:32 +00:00
|
|
|
from tests.base_test import BaseTest
|
2020-12-07 21:23:41 +00:00
|
|
|
from crc import mail
|
|
|
|
|
|
|
|
|
|
|
|
# class TestEmailDirectly(BaseTest):
|
|
|
|
#
|
|
|
|
# def test_email_directly(self):
|
|
|
|
# recipients = ['michaelc@cullerton.com']
|
|
|
|
# sender = 'michaelc@cullerton.com'
|
|
|
|
# with mail.record_messages() as outbox:
|
|
|
|
# mail.send_message(subject='testing',
|
|
|
|
# body='test',
|
|
|
|
# recipients=recipients,
|
|
|
|
# sender=sender)
|
|
|
|
# assert len(outbox) == 1
|
|
|
|
# assert outbox[0].subject == "testing"
|
2020-12-06 15:22:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestEmailScript(BaseTest):
|
|
|
|
|
|
|
|
def test_email_script(self):
|
2020-12-07 21:23:41 +00:00
|
|
|
with mail.record_messages() as outbox:
|
|
|
|
|
|
|
|
workflow = self.create_workflow('email_script')
|
|
|
|
|
|
|
|
first_task = self.get_workflow_api(workflow).next_task
|
|
|
|
# self.assertEqual('Activity_GetData', first_task.name)
|
|
|
|
workflow = self.get_workflow_api(workflow)
|
|
|
|
self.complete_form(workflow, first_task, {'email_address': 'michaelc@cullerton.com'})
|
2020-12-06 15:22:32 +00:00
|
|
|
|
2020-12-07 21:23:41 +00:00
|
|
|
self.assertEqual(1, len(outbox))
|
|
|
|
self.assertEqual("My Email Subject", outbox[0].subject)
|