mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 10:03:21 -04:00
Update password on user profile with new endpoint
This commit is contained in:
@@ -201,8 +201,7 @@ def user_profile_password():
|
|||||||
form = ChangePasswordForm(_check_password)
|
form = ChangePasswordForm(_check_password)
|
||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
current_user.set_password(form.new_password.data)
|
user_api_client.update_password(current_user.id, password=form.new_password.data)
|
||||||
user_api_client.update_user(current_user)
|
|
||||||
return redirect(url_for('.user_profile'))
|
return redirect(url_for('.user_profile'))
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ def test_should_redirect_after_password_change(
|
|||||||
api_user_active,
|
api_user_active,
|
||||||
mock_login,
|
mock_login,
|
||||||
mock_get_user,
|
mock_get_user,
|
||||||
mock_update_user,
|
mock_update_user_password,
|
||||||
mock_verify_password,
|
mock_verify_password,
|
||||||
):
|
):
|
||||||
data = {
|
data = {
|
||||||
|
|||||||
@@ -801,6 +801,14 @@ def mock_update_user(mocker, api_user_active):
|
|||||||
return mocker.patch('app.user_api_client.update_user', side_effect=_update)
|
return mocker.patch('app.user_api_client.update_user', side_effect=_update)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope='function')
|
||||||
|
def mock_update_user_password(mocker, api_user_active):
|
||||||
|
def _update(user_id, **kwargs):
|
||||||
|
return api_user_active
|
||||||
|
|
||||||
|
return mocker.patch('app.user_api_client.update_password', side_effect=_update)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function')
|
@pytest.fixture(scope='function')
|
||||||
def mock_update_user_attribute(mocker, api_user_active):
|
def mock_update_user_attribute(mocker, api_user_active):
|
||||||
def _update(user_id, **kwargs):
|
def _update(user_id, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user