Stop using logged_in_client_with_session 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

A few of our tests still use an older fixture called
`logged_in_client_with_session`. It’s not clear how this is different
from `logged_in_client`, which we have replaced with `client_request`.

So this commit goes ahead and converts all the tests using
`logged_in_client_with_session` to use `client_request` instead.
This commit is contained in:
Chris Hill-Scott
2022-01-04 19:04:45 +00:00
parent 0706664be4
commit c37258fd0d
2 changed files with 20 additions and 35 deletions

View File

@@ -4,16 +4,18 @@ from tests.conftest import SERVICE_ONE_ID
def test_render_sign_out_redirects_to_sign_in(
logged_in_client_with_session
client_request
):
with logged_in_client_with_session.session_transaction() as session:
with client_request.session_transaction() as session:
assert session
response = logged_in_client_with_session.get(
url_for('main.sign_out'))
assert response.status_code == 302
assert response.location == url_for(
'main.index', _external=True)
with logged_in_client_with_session.session_transaction() as session:
client_request.get(
'main.sign_out',
_expected_redirect=url_for(
'main.index',
_external=True,
)
)
with client_request.session_transaction() as session:
assert not session
@@ -54,13 +56,15 @@ def test_sign_out_user(
def test_sign_out_of_two_sessions(
logged_in_client_with_session
client_request
):
logged_in_client_with_session.get(
url_for('main.sign_out'))
with logged_in_client_with_session.session_transaction() as session:
client_request.get(
'main.sign_out',
_expected_status=302,
)
with client_request.session_transaction() as session:
assert not session
response = logged_in_client_with_session.get(
url_for('main.sign_out'))
assert response.status_code == 302
client_request.get(
'main.sign_out',
_expected_status=302,
)