Allow the admin app to send one-off letters

This commit modifies the code paths the admin app uses to send one off
emails and text messages to also accept letters.

This mostly worked already, the two changes were:
- making sure that one-off letters are processed by the correct task,
  from the correct queue
- one-off letters sent from a service in research mode don’t get put on
  a queue and go straight to `delivered` (because we don’t want to send
  them for real)
This commit is contained in:
Chris Hill-Scott
2018-10-31 14:30:46 +00:00
parent 87017fc3d1
commit 674cdbd265
4 changed files with 65 additions and 21 deletions

View File

@@ -258,6 +258,22 @@ def test_send_one_off_letter_notification_should_use_template_reply_to_text(samp
assert notification.reply_to_text == "Edinburgh, ED1 1AA"
def test_send_one_off_letter_should_not_make_pdf_in_research_mode(sample_letter_template):
sample_letter_template.service.research_mode = True
data = {
'to': 'A. Name',
'template_id': str(sample_letter_template.id),
'created_by': str(sample_letter_template.service.created_by_id)
}
notification = send_one_off_notification(service_id=sample_letter_template.service.id, post_data=data)
notification = Notification.query.get(notification['id'])
assert notification.status == "delivered"
def test_send_one_off_sms_notification_should_use_sms_sender_reply_to_text(sample_service, celery_mock):
template = create_template(service=sample_service, template_type=SMS_TYPE)
sms_sender = create_service_sms_sender(