mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-17 04:59:37 -04:00
Fix app config leaking between tests
We need to re-initialise the webauthn_server module with original app config, since this state is global across all tests. Since the behaviour of the original fixture wasn't specific to verifying the origin, I've renamed the fixture as part of making it global. In order to keep the fixture simple, I've rewritten the test for the webauthn_server module, so they don't touch the app fixture.
This commit is contained in:
@@ -2,7 +2,6 @@ import pytest
|
||||
from fido2 import cbor
|
||||
from flask import url_for
|
||||
|
||||
from app import webauthn_server
|
||||
from app.models.webauthn_credential import RegistrationError
|
||||
|
||||
|
||||
@@ -21,18 +20,10 @@ def test_begin_register_returns_encoded_options(
|
||||
mocker,
|
||||
platform_admin_user,
|
||||
platform_admin_client,
|
||||
webauthn_dev_server,
|
||||
):
|
||||
# override base URL so it's consistent on CI and locally
|
||||
mocker.patch.dict(
|
||||
app_.config,
|
||||
values={'ADMIN_BASE_URL': 'http://localhost:6012'}
|
||||
)
|
||||
webauthn_server.init_app(app_)
|
||||
mocker.patch('app.user_api_client.get_webauthn_credentials_for_user', return_value=[])
|
||||
|
||||
response = platform_admin_client.get(
|
||||
url_for('main.webauthn_begin_register')
|
||||
)
|
||||
response = platform_admin_client.get(url_for('main.webauthn_begin_register'))
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
@@ -50,7 +41,7 @@ def test_begin_register_returns_encoded_options(
|
||||
|
||||
relying_party_options = webauthn_options['rp']
|
||||
assert relying_party_options['name'] == 'GOV.UK Notify'
|
||||
assert relying_party_options['id'] == 'localhost'
|
||||
assert relying_party_options['id'] == 'webauthn.io'
|
||||
|
||||
|
||||
def test_begin_register_includes_existing_credentials(
|
||||
|
||||
Reference in New Issue
Block a user