Files
ocean/backend/tests/测试结果反馈.md

84 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 后端 API 测试结果与反馈
**最近一次执行**:回归测试(后端工程师修复登录 500 后)
**测试环境**:对已启动服务 `http://127.0.0.1:8000` 发起 HTTP 请求(测试与开发环境隔离)
---
## 回归测试结果汇总
| 结果 | 数量 |
|------|------|
| **通过** | **35** |
| **失败** | 0 |
| **错误** | 0 |
| **合计** | 35 |
**结论:全部用例通过,回归测试通过。**
---
## 用例明细(35 个)
### 认证(4
- test_login_success_returns_200_with_token_and_user ✓
- test_login_wrong_credentials_returns_401_with_code_and_message ✓
- test_login_missing_username_returns_400 ✓
- test_login_missing_password_returns_400 ✓
### 项目列表(10
- test_list_without_token_returns_401 ✓
- test_list_with_token_returns_200_with_list_total_page_page_size ✓
- test_list_empty_result_has_empty_list_and_total_zero ✓
- test_list_accepts_search_type_name_and_keyword ✓
- test_list_accepts_search_type_code_and_keyword ✓
- test_list_accepts_progress_filter ✓
- test_list_accepts_cost_filter ✓
- test_list_accepts_date_filter_and_date_range ✓
- test_list_accepts_date_abnormal_filter ✓
- test_list_items_contain_required_fields ✓
- test_list_respects_page_and_page_size ✓
### 项目详情(4
- test_detail_without_token_returns_401 ✓
- test_detail_existing_project_returns_200_with_full_fields ✓
- test_detail_nonexistent_project_returns_404_with_code_and_message ✓
- test_detail_missing_id_returns_400 ✓
### 新建项目(5
- test_create_without_token_returns_401 ✓
- test_create_non_market_role_returns_403 ✓
- test_create_market_with_contract_code_and_name_returns_201_with_id_and_message ✓
- test_create_missing_contract_code_returns_400 ✓
- test_create_missing_project_name_returns_400 ✓
- test_create_validation_error_may_include_errors_array ✓
### 更新项目(4
- test_update_without_token_returns_401 ✓
- test_update_missing_id_returns_400 ✓
- test_update_existing_project_returns_200_with_id_and_save_success_message ✓
- test_update_nonexistent_project_returns_404 ✓
### 操作日志(6
- test_logs_without_token_returns_401 ✓
- test_logs_missing_id_returns_400 ✓
- test_logs_with_token_returns_200_with_list_total_page_page_size ✓
- test_logs_nonexistent_project_returns_404 ✓
- test_logs_after_update_returns_record_with_summary ✓
- test_logs_list_items_contain_required_fields ✓
---
## 复现命令
```bash
cd backend
pytest tests/ -v
```