mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 03:13:42 -05:00
TestClient now sets up app.current_session correctly
previously it was attempting to do so from outside of a session transaction, so failing. This still only happens when you've called `login` with a mocker and service json blob, which is probably worth reconsidering in the future, but for now, updated logged_in_client to use the extra login args
This commit is contained in:
committed by
Chris Hill-Scott
parent
d2680fe885
commit
154271b46e
@@ -18,7 +18,8 @@ class TestClient(FlaskClient):
|
||||
mocker.patch('app.user_api_client.get_user', return_value=user)
|
||||
mocker.patch('app.events_api_client.create_event')
|
||||
if mocker and service:
|
||||
session['service_id'] = service['id']
|
||||
with self.session_transaction() as session:
|
||||
session['service_id'] = service['id']
|
||||
mocker.patch('app.service_api_client.get_service', return_value={'data': service})
|
||||
login_user(user, remember=True)
|
||||
|
||||
|
||||
@@ -1354,12 +1354,12 @@ def client(app_):
|
||||
def logged_in_client(
|
||||
client,
|
||||
active_user_with_permissions,
|
||||
mocker,
|
||||
service_one,
|
||||
mock_login,
|
||||
mock_get_user,
|
||||
mock_get_service,
|
||||
mock_has_permissions
|
||||
):
|
||||
client.login(active_user_with_permissions)
|
||||
client.login(active_user_with_permissions, mocker, service_one)
|
||||
yield client
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user