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:
Leo Hemsted
2017-01-30 13:59:43 +00:00
committed by Chris Hill-Scott
parent d2680fe885
commit 154271b46e
2 changed files with 5 additions and 4 deletions

View File

@@ -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)