mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
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:
@@ -487,11 +487,10 @@ def test_two_factor_email_link_when_user_is_locked_out(
|
||||
|
||||
|
||||
def test_two_factor_email_link_used_when_user_already_logged_in(
|
||||
logged_in_client,
|
||||
client_request,
|
||||
valid_token
|
||||
):
|
||||
response = logged_in_client.post(
|
||||
url_for_endpoint_with_token('main.two_factor_email', token=valid_token)
|
||||
client_request.post_url(
|
||||
url_for_endpoint_with_token('main.two_factor_email', token=valid_token),
|
||||
_expected_redirect=url_for('main.show_accounts_or_dashboard', _external=True),
|
||||
)
|
||||
assert response.status_code == 302
|
||||
assert response.location == url_for('main.show_accounts_or_dashboard', _external=True)
|
||||
|
||||
Reference in New Issue
Block a user