mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 04:08:25 -04:00
Reduce the errors related to user fixtures
We were using user fixtures in a lot of parameterized tests, but this is no longer allowed in Pytest 5. To avoid having to split up the parametrized tests (which would make the test files a lot longer and slightly more difficult to read) this commit creates functions which return various types of user json so that we can use these as the test parameters instead.
This commit is contained in:
@@ -25,8 +25,8 @@ from tests import (
|
||||
from tests.conftest import (
|
||||
ORGANISATION_ID,
|
||||
SERVICE_ONE_ID,
|
||||
active_caseworking_user,
|
||||
active_user_view_permissions,
|
||||
create_active_caseworking_user,
|
||||
create_active_user_view_permissions,
|
||||
mock_get_inbound_sms_summary,
|
||||
mock_get_inbound_sms_summary_with_no_messages,
|
||||
normalize_spaces,
|
||||
@@ -101,16 +101,15 @@ stub_template_stats = [
|
||||
|
||||
|
||||
@pytest.mark.parametrize('user', (
|
||||
active_user_view_permissions,
|
||||
active_caseworking_user,
|
||||
create_active_user_view_permissions(),
|
||||
create_active_caseworking_user(),
|
||||
))
|
||||
def test_redirect_from_old_dashboard(
|
||||
logged_in_client,
|
||||
user,
|
||||
mocker,
|
||||
fake_uuid,
|
||||
):
|
||||
mocker.patch('app.user_api_client.get_user', return_value=user(fake_uuid))
|
||||
mocker.patch('app.user_api_client.get_user', return_value=user)
|
||||
expected_location = 'http://localhost/services/{}'.format(SERVICE_ONE_ID)
|
||||
|
||||
response = logged_in_client.get('/services/{}/dashboard'.format(SERVICE_ONE_ID))
|
||||
|
||||
Reference in New Issue
Block a user