mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
stop putting invite user objects in the session
the invited_user objects can be arbitrarily large, and when we put them in the session we risk going over the session cookie's 4kb size limit. since https://github.com/alphagov/notifications-admin/pull/3827 was merged, we store the user id in the session. Now that's been live for a day or two we can safely stop putting the rich object in the session. Needed to change a bunch of tests for this to make sure appropriate mocks were set. Also some tests were accidentally re-using fake_uuid. Still pop the object when cleaning up sessions. We'll need to remove that in a future PR.
This commit is contained in:
@@ -176,6 +176,7 @@ def test_activate_user_redirects_to_service_dashboard_if_user_already_belongs_to
|
||||
api_user_active,
|
||||
mock_login,
|
||||
mock_get_service,
|
||||
mock_get_invited_user_by_id,
|
||||
):
|
||||
mocker.patch('app.user_api_client.add_user_to_service', side_effect=HTTPError(
|
||||
response=Mock(
|
||||
@@ -189,10 +190,10 @@ def test_activate_user_redirects_to_service_dashboard_if_user_already_belongs_to
|
||||
))
|
||||
|
||||
# Can't use `with client.session_transaction()...` here since activate_session is not a view function
|
||||
flask_session['invited_user'] = sample_invite
|
||||
flask_session['invited_user_id'] = sample_invite['id']
|
||||
|
||||
response = activate_user(api_user_active['id'])
|
||||
|
||||
assert response.location == url_for('main.service_dashboard', service_id=service_one['id'])
|
||||
|
||||
flask_session.pop('invited_user')
|
||||
flask_session.pop('invited_user_id')
|
||||
|
||||
Reference in New Issue
Block a user