Stop using logged_in_client fixture

We have a `client_request` fixture which does a bunch of useful stuff
like:
- checking the status code of the response
- returning a `BeautifulSoup` object

Lots of our tests still use an older fixture called `logged_in_client`.
This is not as good because:
- it returns a raw `Response` object
- doesn’t do the additional checks
- means our tests contain a lot of repetetive boilerplate like `page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')`

This commit converts all the tests using `logged_in_client` to:
use `client_request` instead.
This commit is contained in:
Chris Hill-Scott
2021-12-31 12:08:14 +00:00
parent 50eae6f935
commit 0706664be4
20 changed files with 341 additions and 291 deletions

View File

@@ -76,7 +76,7 @@ def test_client_gets_notifications_for_service_and_job_by_page_posts_for_to(mock
mock_post.assert_called_once_with(**expected_call)
def test_send_notification(mocker, logged_in_client, active_user_with_permissions):
def test_send_notification(mocker, client_request, active_user_with_permissions):
mock_post = mocker.patch('app.notify_client.notification_api_client.NotificationApiClient.post')
NotificationApiClient().send_notification(
'foo',
@@ -96,7 +96,7 @@ def test_send_notification(mocker, logged_in_client, active_user_with_permission
)
def test_send_precompiled_letter(mocker, logged_in_client, active_user_with_permissions):
def test_send_precompiled_letter(mocker, client_request, active_user_with_permissions):
mock_post = mocker.patch('app.notify_client.notification_api_client.NotificationApiClient.post')
NotificationApiClient().send_precompiled_letter(
'abcd-1234',