Replace uses of client to set request context

Some tests use the `client` fixture but don’t call any of its methods.
The reason for doing this is because the test depends on something in
the request context.

This commit replaces all those instances with `client_request`, which
also sets the request context.

These tests are the last ones that still use the `client` fixture. By
replacing it with `client_request` we will be able to say that no tests
should be using the `client` fixture directly.
This commit is contained in:
Chris Hill-Scott
2022-01-04 18:33:23 +00:00
parent 7e707db4b2
commit 6540701aa7
19 changed files with 87 additions and 70 deletions

View File

@@ -2908,7 +2908,7 @@ def test_dont_show_preview_letter_templates_for_bad_filetype(
def test_route_permissions(
mocker,
notify_admin,
client,
client_request,
api_user_active,
service_one,
mock_get_service_template,
@@ -2943,7 +2943,7 @@ def test_route_permissions(
def test_route_permissions_send_check_notifications(
mocker,
notify_admin,
client,
client_request,
api_user_active,
service_one,
mock_send_notification,
@@ -2953,12 +2953,12 @@ def test_route_permissions_send_check_notifications(
response_code,
method
):
with client.session_transaction() as session:
with client_request.session_transaction() as session:
session['recipient'] = '07700900001'
session['placeholders'] = {'name': 'a'}
validate_route_permission_with_client(
mocker,
client,
client_request,
method,
response_code,
url_for(
@@ -2980,7 +2980,7 @@ def test_route_permissions_send_check_notifications(
def test_route_permissions_sending(
mocker,
notify_admin,
client,
client_request,
api_user_active,
service_one,
mock_get_service_template,