From fa4707811e65bcd582a02071bda28133df53e700 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Thu, 11 Mar 2021 11:34:24 -0500 Subject: [PATCH] Removed the test and templates from the unused mails service. Mails was removed in previous commit. --- .../mails/ramp_up_approval_request.html | 2 - .../mails/ramp_up_approval_request.txt | 2 - ...ramp_up_approval_request_first_review.html | 2 - .../ramp_up_approval_request_first_review.txt | 2 - .../templates/mails/ramp_up_approved.html | 1 - .../templates/mails/ramp_up_approved.txt | 1 - .../templates/mails/ramp_up_denied.html | 1 - crc/static/templates/mails/ramp_up_denied.txt | 1 - .../mails/ramp_up_denied_first_approver.html | 1 - .../mails/ramp_up_denied_first_approver.txt | 1 - .../templates/mails/ramp_up_submission.html | 5 - .../templates/mails/ramp_up_submission.txt | 5 - tests/emails/test_mails.py | 113 ------------------ 13 files changed, 137 deletions(-) delete mode 100644 crc/static/templates/mails/ramp_up_approval_request.html delete mode 100644 crc/static/templates/mails/ramp_up_approval_request.txt delete mode 100644 crc/static/templates/mails/ramp_up_approval_request_first_review.html delete mode 100644 crc/static/templates/mails/ramp_up_approval_request_first_review.txt delete mode 100644 crc/static/templates/mails/ramp_up_approved.html delete mode 100644 crc/static/templates/mails/ramp_up_approved.txt delete mode 100644 crc/static/templates/mails/ramp_up_denied.html delete mode 100644 crc/static/templates/mails/ramp_up_denied.txt delete mode 100644 crc/static/templates/mails/ramp_up_denied_first_approver.html delete mode 100644 crc/static/templates/mails/ramp_up_denied_first_approver.txt delete mode 100644 crc/static/templates/mails/ramp_up_submission.html delete mode 100644 crc/static/templates/mails/ramp_up_submission.txt delete mode 100644 tests/emails/test_mails.py diff --git a/crc/static/templates/mails/ramp_up_approval_request.html b/crc/static/templates/mails/ramp_up_approval_request.html deleted file mode 100644 index 506fdf16..00000000 --- a/crc/static/templates/mails/ramp_up_approval_request.html +++ /dev/null @@ -1,2 +0,0 @@ -

A Research Ramp-up approval request from {{ primary_investigator }} is now available for your review in your - Research Ramp-up Toolkit]

\ No newline at end of file diff --git a/crc/static/templates/mails/ramp_up_approval_request.txt b/crc/static/templates/mails/ramp_up_approval_request.txt deleted file mode 100644 index 53d8e1ef..00000000 --- a/crc/static/templates/mails/ramp_up_approval_request.txt +++ /dev/null @@ -1,2 +0,0 @@ -A Research Ramp-up approval request from {{ primary_investigator }} is now available for your review in your -Research Ramp-up Toolkit: https://rrt.uvadcos.io/app/approvals. \ No newline at end of file diff --git a/crc/static/templates/mails/ramp_up_approval_request_first_review.html b/crc/static/templates/mails/ramp_up_approval_request_first_review.html deleted file mode 100644 index 1c7cb3c7..00000000 --- a/crc/static/templates/mails/ramp_up_approval_request_first_review.html +++ /dev/null @@ -1,2 +0,0 @@ -

A Research Ramp-up approval request from {{ primary_investigator }} and is now available for your review in your - Research Ramp-up Toolkit.

\ No newline at end of file diff --git a/crc/static/templates/mails/ramp_up_approval_request_first_review.txt b/crc/static/templates/mails/ramp_up_approval_request_first_review.txt deleted file mode 100644 index db6cc50e..00000000 --- a/crc/static/templates/mails/ramp_up_approval_request_first_review.txt +++ /dev/null @@ -1,2 +0,0 @@ -A Research Ramp-up approval request from {{ primary_investigator }} is now available for your review in your -Research Ramp-up Toolkit at https://rrt.uvadcos.io/app/approvals. \ No newline at end of file diff --git a/crc/static/templates/mails/ramp_up_approved.html b/crc/static/templates/mails/ramp_up_approved.html deleted file mode 100644 index 57fc1dc4..00000000 --- a/crc/static/templates/mails/ramp_up_approved.html +++ /dev/null @@ -1 +0,0 @@ -

Your Research Ramp-up Plan has been approved by {{ approver_1 }} {% if approver_2 %}and {{ approver_2 }} {% endif %}

\ No newline at end of file diff --git a/crc/static/templates/mails/ramp_up_approved.txt b/crc/static/templates/mails/ramp_up_approved.txt deleted file mode 100644 index 2eec582b..00000000 --- a/crc/static/templates/mails/ramp_up_approved.txt +++ /dev/null @@ -1 +0,0 @@ -Your Research Ramp-up Plan has been approved by {{ approver_1 }} {% if approver_2 %}and {{ approver_2 }} {% endif %} \ No newline at end of file diff --git a/crc/static/templates/mails/ramp_up_denied.html b/crc/static/templates/mails/ramp_up_denied.html deleted file mode 100644 index 7a40c1ea..00000000 --- a/crc/static/templates/mails/ramp_up_denied.html +++ /dev/null @@ -1 +0,0 @@ -

Your Research Ramp-up Plan has been denied by {{ approver }}. Please return to the Research Ramp-up Plan application and review the comments from {{ approver }} on the home page. Next, open the application and locate the first step where changes are needed. Continue to complete additional steps saving your work along the way. Review your revised Research Ramp-up Plan and res-submit for approval.

\ No newline at end of file diff --git a/crc/static/templates/mails/ramp_up_denied.txt b/crc/static/templates/mails/ramp_up_denied.txt deleted file mode 100644 index 120522b8..00000000 --- a/crc/static/templates/mails/ramp_up_denied.txt +++ /dev/null @@ -1 +0,0 @@ - Your Research Ramp-up Plan has been denied by {{ approver }}. Please return to the Research Ramp-up Plan application and review the comments from {{ approver }} on the home page. Next, open the application and locate the first step where changes are needed. Continue to complete additional steps saving your work along the way. Review your revised Research Ramp-up Plan and res-submit for approval. \ No newline at end of file diff --git a/crc/static/templates/mails/ramp_up_denied_first_approver.html b/crc/static/templates/mails/ramp_up_denied_first_approver.html deleted file mode 100644 index e58cae99..00000000 --- a/crc/static/templates/mails/ramp_up_denied_first_approver.html +++ /dev/null @@ -1 +0,0 @@ -

The Research Ramp-up Plan submitted by {{ primary_investigator }} was denied by {{ approver_2 }} and returned for requested updates. You may see comments related to this denial in on your Research Ramp-up Toolkit Approval dashboard.

\ No newline at end of file diff --git a/crc/static/templates/mails/ramp_up_denied_first_approver.txt b/crc/static/templates/mails/ramp_up_denied_first_approver.txt deleted file mode 100644 index 7172c856..00000000 --- a/crc/static/templates/mails/ramp_up_denied_first_approver.txt +++ /dev/null @@ -1 +0,0 @@ -The Research Ramp-up Plan submitted by {{ primary_investigator }} was denied by {{ approver_2 }} and returned for requested updates. You may see comments related to this denial in on your Research Ramp-up Toolkit Approval dashboard. \ No newline at end of file diff --git a/crc/static/templates/mails/ramp_up_submission.html b/crc/static/templates/mails/ramp_up_submission.html deleted file mode 100644 index 2c57c916..00000000 --- a/crc/static/templates/mails/ramp_up_submission.html +++ /dev/null @@ -1,5 +0,0 @@ -

Your Research Ramp-up Plan (RRP) has been submitted for review by {{ approver_1 }} {% if approver_2 %}and {{ approver_2 }} {% endif %}. After completion of the review step you will receive email notification of its approval or if additional information and/or modifications are required, along with instructions on how to proceed. Return to the Research Ramp-up Plan application to proceed as instructed.

- -

In the meantime, please make sure all required training has been completed and needed supplies secured. You will be asked to confirm that both of these requirements have been met before reopening the research space approved in your RRP.

- -

Additionally, if there are any unknown Area Monitors for the spaces listed in your RRP, please contact your approvers to determine either who they are or how you can find out. Missing Area Monitors will need to be entered before proceeding as well.

diff --git a/crc/static/templates/mails/ramp_up_submission.txt b/crc/static/templates/mails/ramp_up_submission.txt deleted file mode 100644 index 14c34500..00000000 --- a/crc/static/templates/mails/ramp_up_submission.txt +++ /dev/null @@ -1,5 +0,0 @@ -Your Research Ramp-up Plan (RRP) has been submitted for review by {{ approver_1 }} {% if approver_2 %}and {{ approver_2 }} {% endif %}. After completion of the review step you will receive email notification of its approval or if additional information and/or modifications are required, along with instructions on how to proceed. Return to the Research Ramp-up Plan application to proceed as instructed. - -In the meantime, please make sure all required training has been completed and needed supplies secured. You will be asked to confirm that both of these requirements have been met before reopening the research space approved in your RRP. - -Additionally, if there are any unknown Area Monitors for the spaces listed in your RRP, please contact your approvers to determine either who they are or how you can find out. Missing Area Monitors will need to be entered before proceeding as well. diff --git a/tests/emails/test_mails.py b/tests/emails/test_mails.py deleted file mode 100644 index e9320f4d..00000000 --- a/tests/emails/test_mails.py +++ /dev/null @@ -1,113 +0,0 @@ -from crc import mail -from crc.models.email import EmailModel -from crc.services.mails import ( - send_ramp_up_submission_email, - send_ramp_up_approval_request_email, - send_ramp_up_approval_request_first_review_email, - send_ramp_up_approved_email, - send_ramp_up_denied_email, - send_ramp_up_denied_email_to_approver -) -from tests.base_test import BaseTest - - -class TestMails(BaseTest): - - def setUp(self): - """Initial setup shared by all TestApprovals tests""" - self.load_example_data() - self.study = self.create_study() - self.workflow = self.create_workflow('random_fact') - - self.sender = 'sender@sartography.com' - self.recipients = ['recipient@sartography.com'] - self.primary_investigator = 'Dr. Bartlett' - self.approver_1 = 'Max Approver' - self.approver_2 = 'Close Reviewer' - - def test_send_ramp_up_submission_email(self): - with mail.record_messages() as outbox: - send_ramp_up_submission_email(self.sender, self.recipients, self.approver_1) - self.assertEqual(len(outbox), 1) - self.assertEqual(outbox[0].subject, 'Research Ramp-up Plan Submitted') - self.assertIn(self.approver_1, outbox[0].body) - self.assertIn(self.approver_1, outbox[0].html) - - send_ramp_up_submission_email(self.sender, self.recipients, self.approver_1, self.approver_2) - self.assertEqual(len(outbox), 2) - self.assertIn(self.approver_1, outbox[1].body) - self.assertIn(self.approver_1, outbox[1].html) - self.assertIn(self.approver_2, outbox[1].body) - self.assertIn(self.approver_2, outbox[1].html) - - db_emails = EmailModel.query.count() - self.assertEqual(db_emails, 2) - - def test_send_ramp_up_approval_request_email(self): - with mail.record_messages() as outbox: - send_ramp_up_approval_request_email(self.sender, self.recipients, self.primary_investigator) - - self.assertEqual(len(outbox), 1) - self.assertEqual(outbox[0].subject, 'Research Ramp-up Plan Approval Request') - self.assertIn(self.primary_investigator, outbox[0].body) - self.assertIn(self.primary_investigator, outbox[0].html) - - db_emails = EmailModel.query.count() - self.assertEqual(db_emails, 1) - - def test_send_ramp_up_approval_request_first_review_email(self): - with mail.record_messages() as outbox: - send_ramp_up_approval_request_first_review_email( - self.sender, self.recipients, self.primary_investigator - ) - - self.assertEqual(len(outbox), 1) - self.assertEqual(outbox[0].subject, 'Research Ramp-up Plan Approval Request') - self.assertIn(self.primary_investigator, outbox[0].body) - self.assertIn(self.primary_investigator, outbox[0].html) - - db_emails = EmailModel.query.count() - self.assertEqual(db_emails, 1) - - def test_send_ramp_up_approved_email(self): - with mail.record_messages() as outbox: - send_ramp_up_approved_email(self.sender, self.recipients, self.approver_1) - self.assertEqual(len(outbox), 1) - self.assertEqual(outbox[0].subject, 'Research Ramp-up Plan Approved') - self.assertIn(self.approver_1, outbox[0].body) - self.assertIn(self.approver_1, outbox[0].html) - - send_ramp_up_approved_email(self.sender, self.recipients, self.approver_1, self.approver_2) - self.assertEqual(len(outbox), 2) - self.assertIn(self.approver_1, outbox[1].body) - self.assertIn(self.approver_1, outbox[1].html) - self.assertIn(self.approver_2, outbox[1].body) - self.assertIn(self.approver_2, outbox[1].html) - - db_emails = EmailModel.query.count() - self.assertEqual(db_emails, 2) - - def test_send_ramp_up_denied_email(self): - with mail.record_messages() as outbox: - send_ramp_up_denied_email(self.sender, self.recipients, self.approver_1) - self.assertEqual(outbox[0].subject, 'Research Ramp-up Plan Denied') - self.assertIn(self.approver_1, outbox[0].body) - self.assertIn(self.approver_1, outbox[0].html) - - db_emails = EmailModel.query.count() - self.assertEqual(db_emails, 1) - - def test_send_send_ramp_up_denied_email_to_approver(self): - with mail.record_messages() as outbox: - send_ramp_up_denied_email_to_approver( - self.sender, self.recipients, self.primary_investigator, self.approver_2 - ) - - self.assertEqual(outbox[0].subject, 'Research Ramp-up Plan Denied') - self.assertIn(self.primary_investigator, outbox[0].body) - self.assertIn(self.primary_investigator, outbox[0].html) - self.assertIn(self.approver_2, outbox[0].body) - self.assertIn(self.approver_2, outbox[0].html) - - db_emails = EmailModel.query.count() - self.assertEqual(db_emails, 1)