mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 02:23:19 -04:00
make sure mock login sets up session correctly
This commit is contained in:
+4
-1
@@ -14,6 +14,7 @@ class TestClient(FlaskClient):
|
|||||||
def login(self, user, mocker=None, service=None):
|
def login(self, user, mocker=None, service=None):
|
||||||
# Skipping authentication here and just log them in
|
# Skipping authentication here and just log them in
|
||||||
with self.session_transaction() as session:
|
with self.session_transaction() as session:
|
||||||
|
session['current_session_id'] = user.current_session_id
|
||||||
session['user_id'] = user.id
|
session['user_id'] = user.id
|
||||||
if mocker:
|
if mocker:
|
||||||
mocker.patch('app.user_api_client.get_user', return_value=user)
|
mocker.patch('app.user_api_client.get_user', return_value=user)
|
||||||
@@ -63,6 +64,7 @@ def user_json(
|
|||||||
platform_admin=False,
|
platform_admin=False,
|
||||||
current_session_id='1234',
|
current_session_id='1234',
|
||||||
organisations=[],
|
organisations=[],
|
||||||
|
services=[]
|
||||||
|
|
||||||
):
|
):
|
||||||
return {
|
return {
|
||||||
@@ -78,7 +80,8 @@ def user_json(
|
|||||||
'max_failed_login_count': max_failed_login_count,
|
'max_failed_login_count': max_failed_login_count,
|
||||||
'platform_admin': platform_admin,
|
'platform_admin': platform_admin,
|
||||||
'current_session_id': current_session_id,
|
'current_session_id': current_session_id,
|
||||||
'organisations': organisations
|
'organisations': organisations,
|
||||||
|
'services': services or permissions.keys()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user