mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
Merge pull request #2183 from alphagov/stop-sending-dvla-org-id
Stop passing dvla_org_id to template preview
This commit is contained in:
@@ -53,7 +53,6 @@ def create_letters_pdf(self, notification_id):
|
|||||||
pdf_data, billable_units = get_letters_pdf(
|
pdf_data, billable_units = get_letters_pdf(
|
||||||
notification.template,
|
notification.template,
|
||||||
contact_block=notification.reply_to_text,
|
contact_block=notification.reply_to_text,
|
||||||
org_id=notification.service.dvla_organisation.id,
|
|
||||||
filename=notification.service.dvla_organisation.filename,
|
filename=notification.service.dvla_organisation.filename,
|
||||||
values=notification.personalisation
|
values=notification.personalisation
|
||||||
)
|
)
|
||||||
@@ -80,7 +79,7 @@ def create_letters_pdf(self, notification_id):
|
|||||||
update_notification_status_by_id(notification_id, 'technical-failure')
|
update_notification_status_by_id(notification_id, 'technical-failure')
|
||||||
|
|
||||||
|
|
||||||
def get_letters_pdf(template, contact_block, org_id, filename, values):
|
def get_letters_pdf(template, contact_block, filename, values):
|
||||||
template_for_letter_print = {
|
template_for_letter_print = {
|
||||||
"subject": template.subject,
|
"subject": template.subject,
|
||||||
"content": template.content
|
"content": template.content
|
||||||
@@ -91,7 +90,6 @@ def get_letters_pdf(template, contact_block, org_id, filename, values):
|
|||||||
'template': template_for_letter_print,
|
'template': template_for_letter_print,
|
||||||
'values': values,
|
'values': values,
|
||||||
'filename': filename,
|
'filename': filename,
|
||||||
'dvla_org_id': org_id,
|
|
||||||
}
|
}
|
||||||
resp = requests_post(
|
resp = requests_post(
|
||||||
'{}/print.pdf'.format(
|
'{}/print.pdf'.format(
|
||||||
|
|||||||
@@ -248,7 +248,6 @@ def preview_letter_template_by_notification_id(service_id, notification_id, file
|
|||||||
'values': notification.personalisation,
|
'values': notification.personalisation,
|
||||||
'date': notification.created_at.isoformat(),
|
'date': notification.created_at.isoformat(),
|
||||||
'filename': service.dvla_organisation.filename,
|
'filename': service.dvla_organisation.filename,
|
||||||
'dvla_org_id': service.dvla_organisation_id,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
url = '{}/preview.{}{}'.format(
|
url = '{}/preview.{}{}'.format(
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ def test_should_have_decorated_tasks_functions():
|
|||||||
def test_get_letters_pdf_calls_notifications_template_preview_service_correctly(
|
def test_get_letters_pdf_calls_notifications_template_preview_service_correctly(
|
||||||
notify_api, mocker, client, sample_letter_template, personalisation):
|
notify_api, mocker, client, sample_letter_template, personalisation):
|
||||||
contact_block = 'Mr Foo,\n1 Test Street,\nLondon\nN1'
|
contact_block = 'Mr Foo,\n1 Test Street,\nLondon\nN1'
|
||||||
dvla_org_id = '002'
|
|
||||||
filename = 'opg'
|
filename = 'opg'
|
||||||
|
|
||||||
with set_config_values(notify_api, {
|
with set_config_values(notify_api, {
|
||||||
@@ -63,14 +62,12 @@ def test_get_letters_pdf_calls_notifications_template_preview_service_correctly(
|
|||||||
get_letters_pdf(
|
get_letters_pdf(
|
||||||
sample_letter_template,
|
sample_letter_template,
|
||||||
contact_block=contact_block,
|
contact_block=contact_block,
|
||||||
org_id=dvla_org_id,
|
|
||||||
filename=filename,
|
filename=filename,
|
||||||
values=personalisation)
|
values=personalisation)
|
||||||
|
|
||||||
assert mock_post.last_request.json() == {
|
assert mock_post.last_request.json() == {
|
||||||
'values': personalisation,
|
'values': personalisation,
|
||||||
'letter_contact_block': contact_block,
|
'letter_contact_block': contact_block,
|
||||||
'dvla_org_id': dvla_org_id,
|
|
||||||
'filename': filename,
|
'filename': filename,
|
||||||
'template': {
|
'template': {
|
||||||
'subject': sample_letter_template.subject,
|
'subject': sample_letter_template.subject,
|
||||||
@@ -87,7 +84,6 @@ def test_get_letters_pdf_calls_notifications_template_preview_service_correctly(
|
|||||||
def test_get_letters_pdf_calculates_billing_units(
|
def test_get_letters_pdf_calculates_billing_units(
|
||||||
notify_api, mocker, client, sample_letter_template, page_count, expected_billable_units):
|
notify_api, mocker, client, sample_letter_template, page_count, expected_billable_units):
|
||||||
contact_block = 'Mr Foo,\n1 Test Street,\nLondon\nN1'
|
contact_block = 'Mr Foo,\n1 Test Street,\nLondon\nN1'
|
||||||
dvla_org_id = '002'
|
|
||||||
filename = 'opg'
|
filename = 'opg'
|
||||||
|
|
||||||
with set_config_values(notify_api, {
|
with set_config_values(notify_api, {
|
||||||
@@ -103,7 +99,7 @@ def test_get_letters_pdf_calculates_billing_units(
|
|||||||
)
|
)
|
||||||
|
|
||||||
_, billable_units = get_letters_pdf(
|
_, billable_units = get_letters_pdf(
|
||||||
sample_letter_template, contact_block=contact_block, org_id=dvla_org_id, filename=filename, values=None)
|
sample_letter_template, contact_block=contact_block, filename=filename, values=None)
|
||||||
|
|
||||||
assert billable_units == expected_billable_units
|
assert billable_units == expected_billable_units
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user