fix(测试): 改进用户创建测试并添加凭据导出验证

- 在测试中增加对凭据导出的验证
- 使用更安全的随机密码生成
- 添加对创建失败情况的测试覆盖
- 更新文档中的测试命令以包含临时目录参数
- 将临时测试目录添加到.gitignore
This commit is contained in:
2026-04-29 13:44:00 +08:00
committed by jkljkluiouio
parent b8220a97c4
commit e96960c539
4 changed files with 101 additions and 19 deletions
+4 -4
View File
@@ -197,15 +197,15 @@ uv sync --extra dev
### 运行测试
```bash
uv run pytest tests/ -v # 全部测试
uv run pytest tests/test_models.py # 只运行模型测试
uv run pytest tests/ -k "password" # 按名称过滤
uv run pytest tests/ -v --basetemp .pytest_tmp # 全部测试
uv run pytest tests/test_models.py --basetemp .pytest_tmp # 只运行模型测试
uv run pytest tests/ -k "password" --basetemp .pytest_tmp # 按名称过滤
```
### 覆盖率报告
```bash
uv run pytest tests/ --cov=tjhlp --cov-report=term-missing
uv run pytest tests/ --cov=tjhlp --cov-report=term-missing --basetemp .pytest_tmp
```
### 代码检查