feat(admin): 添加用户管理相关文件
添加用户管理视图、API和状态管理文件
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
"""
|
||||
测试验证服务
|
||||
"""
|
||||
|
||||
from core.validation_service import validation_service
|
||||
|
||||
print('测试验证服务...')
|
||||
|
||||
# 测试用户名验证
|
||||
print('\n1. 测试用户名验证:')
|
||||
result = validation_service.validate_username("")
|
||||
print(f' 空用户名: {result}')
|
||||
|
||||
result = validation_service.validate_username("ab")
|
||||
print(f' 太短(2字符): {result}')
|
||||
|
||||
result = validation_service.validate_username("a" * 100)
|
||||
print(f' 太长(100字符): {result}')
|
||||
|
||||
result = validation_service.validate_username("user@#$%")
|
||||
print(f' 特殊字符: {result}')
|
||||
|
||||
result = validation_service.validate_username("valid_user_123")
|
||||
print(f' 有效用户名: {result}')
|
||||
|
||||
# 测试邮箱验证
|
||||
print('\n2. 测试邮箱验证:')
|
||||
result = validation_service.validate_email("")
|
||||
print(f' 空邮箱: {result}')
|
||||
|
||||
result = validation_service.validate_email("invalid-email")
|
||||
print(f' 无效格式: {result}')
|
||||
|
||||
result = validation_service.validate_email("test@example.com")
|
||||
print(f' 有效邮箱: {result}')
|
||||
|
||||
# 测试角色数据验证
|
||||
print('\n3. 测试角色数据验证:')
|
||||
result = validation_service.validate_role_data({"name": "", "code": "test"})
|
||||
print(f' 空角色名: {result}')
|
||||
|
||||
result = validation_service.validate_role_data({"name": "测试角色", "code": ""})
|
||||
print(f' 空角色编码: {result}')
|
||||
|
||||
result = validation_service.validate_role_data({"name": "测试角色", "code": "test_role"})
|
||||
print(f' 有效角色数据: {result}')
|
||||
|
||||
print('\n✅ 验证服务测试通过!')
|
||||
Reference in New Issue
Block a user