Fix inviting existing users

The API needs the id of the user, not the id of the invite.

The problem with the tests is that the update mock returned a different
user ID than the user it was being passed. So the tests didn’t catch
this.
This commit is contained in:
Chris Hill-Scott
2019-06-06 17:24:48 +01:00
parent f2303ff20a
commit 6130004b0c
3 changed files with 6 additions and 3 deletions

View File

@@ -1652,6 +1652,7 @@ def mock_verify_password(mocker):
@pytest.fixture(scope='function')
def mock_update_user_password(mocker, api_user_active):
def _update(user_id, password):
api_user_active['id'] = user_id
return api_user_active
return mocker.patch('app.user_api_client.update_password', side_effect=_update)
@@ -1660,6 +1661,7 @@ def mock_update_user_password(mocker, api_user_active):
@pytest.fixture(scope='function')
def mock_update_user_attribute(mocker, api_user_active):
def _update(user_id, **kwargs):
api_user_active['id'] = user_id
return api_user_active
return mocker.patch('app.user_api_client.update_user_attribute', side_effect=_update)
@@ -1668,6 +1670,7 @@ def mock_update_user_attribute(mocker, api_user_active):
@pytest.fixture
def mock_activate_user(mocker, api_user_active):
def _activate(user_id):
api_user_active['id'] = user_id
return {'data': api_user_active}
return mocker.patch('app.user_api_client.activate_user', side_effect=_activate)