diff --git a/app/schemas.py b/app/schemas.py index b646b7c5c..b6ffe738c 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -107,6 +107,7 @@ class UserSchema(BaseSchema): class UserUpdateAttributeSchema(BaseSchema): + auth_type = field_for(models.User, 'auth_type') class Meta: model = models.User diff --git a/tests/app/user/test_rest.py b/tests/app/user/test_rest.py index 28fcef05b..2a36d488e 100644 --- a/tests/app/user/test_rest.py +++ b/tests/app/user/test_rest.py @@ -546,3 +546,15 @@ def test_update_user_resets_failed_login_count_if_updating_password(client, samp assert resp.status_code == 200 assert user.failed_login_count == 0 + + +def test_update_user_auth_type(admin_request, sample_user): + assert sample_user.auth_type == 'sms_auth' + resp = admin_request.post( + 'user.update_user_attribute', + user_id=sample_user.id, + _data={'auth_type': 'email_auth'}, + ) + + assert resp['data']['id'] == str(sample_user.id) + assert resp['data']['auth_type'] == 'email_auth'