Split generating authorization headers by type

In response to [1].

[1]: https://github.com/alphagov/notifications-api/pull/3300#discussion_r681653248
This commit is contained in:
Ben Thorner
2021-08-04 15:12:09 +01:00
parent 5a1636e41f
commit 0312e2a528
33 changed files with 526 additions and 512 deletions

View File

@@ -4,14 +4,14 @@ from datetime import date, datetime
from flask import url_for
from app.dao.templates_dao import dao_update_template
from tests import create_authorization_header
from tests import create_admin_authorization_header
from tests.app.db import create_letter_contact
def test_template_history_version(notify_api, sample_user, sample_template):
with notify_api.test_request_context():
with notify_api.test_client() as client:
auth_header = create_authorization_header()
auth_header = create_admin_authorization_header()
endpoint = url_for(
'template.get_template_version',
service_id=sample_template.service.id,
@@ -38,7 +38,7 @@ def test_previous_template_history_version(notify_api, sample_template):
dao_update_template(sample_template)
with notify_api.test_request_context():
with notify_api.test_client() as client:
auth_header = create_authorization_header()
auth_header = create_admin_authorization_header()
endpoint = url_for(
'template.get_template_version',
service_id=sample_template.service.id,
@@ -59,7 +59,7 @@ def test_previous_template_history_version(notify_api, sample_template):
def test_404_missing_template_version(notify_api, sample_template):
with notify_api.test_request_context():
with notify_api.test_client() as client:
auth_header = create_authorization_header()
auth_header = create_admin_authorization_header()
endpoint = url_for(
'template.get_template_version',
service_id=sample_template.service.id,
@@ -82,7 +82,7 @@ def test_all_versions_of_template(notify_api, sample_template):
dao_update_template(sample_template)
sample_template.content = newest_content
dao_update_template(sample_template)
auth_header = create_authorization_header()
auth_header = create_admin_authorization_header()
endpoint = url_for(
'template.get_template_versions',
service_id=sample_template.service.id,
@@ -102,7 +102,7 @@ def test_all_versions_of_template(notify_api, sample_template):
def test_update_template_reply_to_updates_history(client, sample_letter_template):
auth_header = create_authorization_header()
auth_header = create_admin_authorization_header()
letter_contact = create_letter_contact(sample_letter_template.service, "Edinburgh, ED1 1AA")
sample_letter_template.reply_to = letter_contact.id