From 375089e5dfcff6f1618ba8c8ddbfcecb0afe600a Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Thu, 6 May 2021 15:32:28 -0400 Subject: [PATCH] test and bpmn file for new get_dashboard_url script --- .../email_dashboard_url.bpmn | 53 +++++++++++++++++++ tests/test_get_dashboard_url_script.py | 12 ++++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tests/data/email_dashboard_url/email_dashboard_url.bpmn diff --git a/tests/data/email_dashboard_url/email_dashboard_url.bpmn b/tests/data/email_dashboard_url/email_dashboard_url.bpmn new file mode 100644 index 00000000..ce75e589 --- /dev/null +++ b/tests/data/email_dashboard_url/email_dashboard_url.bpmn @@ -0,0 +1,53 @@ + + + + + Flow_0c51a4b + + + + + Flow_1rfvzi5 + + + + Flow_0c51a4b + Flow_1ker6ik + dashboard_url = get_dashboard_url() + + + <a href="{{dashboard_url}}">{{dashboard_url}}</a> + Flow_1ker6ik + Flow_1rfvzi5 + email(subject='My Email Subject', recipients="test@example.com") + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_get_dashboard_url_script.py b/tests/test_get_dashboard_url_script.py index a464400d..988c4909 100644 --- a/tests/test_get_dashboard_url_script.py +++ b/tests/test_get_dashboard_url_script.py @@ -1,7 +1,17 @@ from tests.base_test import BaseTest +from crc import app, mail class TestGetDashboardURL(BaseTest): def test_get_dashboard_url(self): - pass + with mail.record_messages() as outbox: + + dashboard_url = f'http://{app.config["FRONTEND"]}' + workflow = self.create_workflow('email_dashboard_url') + self.get_workflow_api(workflow) + + self.assertEqual(1, len(outbox)) + self.assertEqual('My Email Subject', outbox[0].subject) + self.assertEqual(['test@example.com'], outbox[0].recipients) + self.assertIn(dashboard_url, outbox[0].body)