fix(addmin): 添加修改用户时同步到casdoor

This commit is contained in:
sophie committed 2026-06-16 14:01:01 +08:00
1 parent 7544361c05
commit 1eb6bf4aad
4 files changed
+573 -5

No files matched your search

+14
View File
@@ -34,6 +34,20 @@ def test_raise_casdoor_set_password_error_maps_policy(app):
assert exc.value.code == 'CASDOOR_PASSWORD_POLICY'
def test_raise_casdoor_add_user_error_maps_policy(app):
with app.app_context():
with pytest.raises(user_api.AppError) as exc:
user_api._raise_casdoor_add_user_error({'status': 'error', 'msg': 'password is too short'})
assert exc.value.code == 'CASDOOR_PASSWORD_POLICY'
def test_raise_casdoor_update_user_error_maps_missing(app):
with app.app_context():
with pytest.raises(user_api.AppError) as exc:
user_api._raise_casdoor_update_user_error({'status': 'error', 'msg': "The user: organization_HX/26050001 doesn't exist"})
assert exc.value.code == 'CASDOOR_USER_NOT_IN_IDP'
def test_extract_casdoor_error_payload_from_runtime_message():
raw = "Casdoor password login failed: {'error': 'invalid_grant', 'error_description': 'wrong password'}"
payload = user_api._extract_casdoor_error_payload(raw)