### User Management API 测试 ### 基础URL @baseUrl = http://localhost:8080/api/v1 ### 1. 创建用户 POST {{baseUrl}}/users Content-Type: application/json { "username": "testuser", "email": "test@example.com", "password": "123456" } ### 2. 创建第二个用户 POST {{baseUrl}}/users Content-Type: application/json { "username": "admin2", "email": "admin2@example.com", "password": "123456" } ### 3. 获取用户列表 (已有功能) GET {{baseUrl}}/users?page=1&page_size=10 ### 4. 获取用户详情 GET {{baseUrl}}/users/1 ### 5. 更新用户信息 PUT {{baseUrl}}/users/1 Content-Type: application/json { "username": "updateduser", "email": "updated@example.com", "avatar": "http://example.com/avatar.jpg", "status": 1 } ### 6. 更新用户状态 (禁用) PUT {{baseUrl}}/users/1 Content-Type: application/json { "status": 0 } ### 7. 删除用户 DELETE {{baseUrl}}/users/2 ### 错误测试场景 ### 8. 创建重复用户名 POST {{baseUrl}}/users Content-Type: application/json { "username": "testuser", "email": "another@example.com", "password": "123456" } ### 9. 创建重复邮箱 POST {{baseUrl}}/users Content-Type: application/json { "username": "anotheruser", "email": "test@example.com", "password": "123456" } ### 10. 获取不存在的用户 GET {{baseUrl}}/users/999 ### 11. 更新不存在的用户 PUT {{baseUrl}}/users/999 Content-Type: application/json { "username": "notexist", "status": 1 } ### 12. 删除不存在的用户 DELETE {{baseUrl}}/users/999 ### 13. 创建用户 - 密码太短 POST {{baseUrl}}/users Content-Type: application/json { "username": "shortpwd", "email": "short@example.com", "password": "123" } ### 14. 创建用户 - 邮箱格式错误 POST {{baseUrl}}/users Content-Type: application/json { "username": "bademail", "email": "not-an-email", "password": "123456" } ### 15. 更新用户 - 用户名改为已存在的 PUT {{baseUrl}}/users/1 Content-Type: application/json { "username": "admin" }