Skip to content

Commit

Permalink
WIP send assgined email
Browse files Browse the repository at this point in the history
  • Loading branch information
srh-sloan committed Jan 7, 2025
1 parent 02b16ed commit a67f460
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
27 changes: 27 additions & 0 deletions services/notify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,33 @@ def send_application_deadline_reminder_email(
email_reply_to_id=self.REPLY_TO_EMAILS_WITH_NOTIFY_ID.get(contact_help_email),
)

def send_assessment_assigned_email(
self,
email_address: str,
reference_number: str,
fund_name: str,
contact_help_email: str,
project_name: str,
assignment_message: str,
assessment_link: str,
lead_assessor_email: str,
govuk_notify_reference: str | None = None,
) -> Notification:
return self._send_email(
email_address,
self.ASSESSMENT_APPLICATION_ASSIGNED,
personalisation={
"fund_name": fund_name,
"reference_number": reference_number,
"project_name": project_name,
"assignment message": assignment_message,
"assessment link": assessment_link,
"lead assessor email": lead_assessor_email,
},
govuk_notify_reference=govuk_notify_reference,
email_reply_to_id=self.REPLY_TO_EMAILS_WITH_NOTIFY_ID.get(contact_help_email),
)


def get_notification_service() -> NotificationService:
return current_app.extensions["notification_service"]
40 changes: 40 additions & 0 deletions tests/test_services/test_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,43 @@ def test_send_application_deadline_reminder_email(self, app):
)
assert resp == Notification(id=uuid.UUID("00000000-0000-0000-0000-000000000005"))
assert request_matcher.call_count == 1

@responses.activate
def test_send_assessment_assigned_email(self, app):
request_matcher = responses.post(
url="https://api.notifications.service.gov.uk/v2/notifications/email",
status=201,
match=[
matchers.json_params_matcher(
{
"email_address": "[email protected]",
"template_id": "d4bdc13e-93b4-48ba-8d22-71bf4f480128",
"personalisation": {
"fund_name": "test fund",
"reference_number": "ABC123",
"project_name": "Unit test project",
"assignment message": "Testing assignment",
"assessment link": "http://google.com/assess",
"lead assessor email": "[email protected]",
},
"email_reply_to_id": "10668b8d-9472-4ce8-ae07-4fcc7bf93a9d",
"reference": "abc123",
}
)
],
json={"id": "00000000-0000-0000-0000-000000000006"}, # partial GOV.UK Notify response
)

resp = get_notification_service().send_assessment_assigned_email(
email_address="[email protected]",
reference_number="ABC123",
fund_name="test fund",
contact_help_email="[email protected]",
project_name="Unit test project",
assignment_message="Testing assignment",
assessment_link="http://google.com/assess",
lead_assessor_email="[email protected]",
govuk_notify_reference="abc123",
)
assert resp == Notification(id=uuid.UUID("00000000-0000-0000-0000-000000000006"))
assert request_matcher.call_count == 1

0 comments on commit a67f460

Please sign in to comment.