test(phase23): KEEP-VERIFY — remove 44 pass shells + fake INV tests, add shell guard
Phase 23 "可信系统测试重建 (REFACTOR)" re-audit. STATUS claimed "10 E2E
files / ~80+ cases" and "INV-011~020 ✅"; measurement showed the opposite.
D-23-A (Critical): V11InvariantsTest's 14 cases asserted only Constants
strings. INV-016 "Banner target types" actually asserted ARTICLE_STATUS_*;
INV-017 "home 8 entries" declared local arrays then asserted
firstRow.length == 4 (tautology, never called the home service);
INV-018/019/020 used appointment/article/account status constants as
stand-ins for permission and data-scope checks. Rewritten to 12 cases:
4 real service-behavior guards (INV-013 via real CounselingService.getDetail
— Matchmaker sees null userRequestSummary, with an assigned-Counselor
counter-proof so global sanitization cannot fake a pass; INV-016 reads the
production ALLOWED_TARGET_TYPES whitelist and asserts no external/http/url/
web entry; INV-017 calls real getHome and pins all 8 codes + order;
INV-019 asserts content_editor reads null), plus assertBehaviorTestExists
turning "行为验证见 XxxTest" pointers into executable Class.forName contracts.
D-23-B (High): 44 `pass` shells across 6 files in tests/e2e (4 files were
100% shells). Gate forbids skip/pass shells. Rewritten in place as honest
placeholders with the full scenario lists preserved.
D-23-C (High, residual): the pytest E2E suite is not executable at all —
no conftest.py anywhere, ~15 fixtures (api_client/verified_user/
banner_factory/...) do not exist. Only run_v11_tests.py really runs
(16 cases, needs a live stack + E2E_PASSWORD).
D-23-D (High, residual, NOT fixed): CI does not chain E2E as the plan
requires. Needs an infrastructure decision on how CI provisions a live
stack; not implemented rather than written unverified.
D-23-E (Medium): the CI migration job claimed to "验证 migration SQL 语法"
but only checked file non-emptiness, while the real syntax/baseline checks
live in MigrationValidationTest (already run by the backend job). Replaced
with a real sequence check (naming / non-empty / unique versions / no
gaps); verified by extracting the exact inline script and running it.
New gate: scripts/check-no-empty-tests.py (AST scan, blocks pass-only and
unconditionally skipped tests) + a CI test-shell-guard job. Verified both
ways: 0 findings on the real tree, 2 precise findings on injected shells.
Negative validation: 3 injected production defects (external_url in the
banner whitelist, swapped home entry order, isMatchmaker returning the full
record) turned exactly inv016/inv017/inv013 red, 9 others green, zero
unrelated failures; md5sum -c confirmed byte-identical restore.
Full regression: 655 tests / 652 passed / 0 failures / 0 errors / 3 skipped
(baseline 657; -2 because 14 vacuous cases were merged into 12). The 3
skips carry explicit reasons (2x @EnabledIfEnvironmentVariable(CI=true),
1x @Disabled "需要完整数据库连接") — none is a shell.
Phase 23 is PARTIALLY closed: fake coverage is gone, but the UAT gate
requires the end-to-end chain to actually execute, so "失败为零可进入 UAT"
is NOT claimed.
This commit is contained in:
@@ -1,57 +1,35 @@
|
||||
"""
|
||||
V1.1 活动互选二阶段同意 E2E 测试骨架
|
||||
测试项目: 活动互选流程重构(INV-014, INV-015)
|
||||
V1.1 活动互选二阶段同意 E2E —— 空壳已移除(Phase 23 KEEP-VERIFY,2026-09-18)
|
||||
|
||||
历史问题
|
||||
--------
|
||||
原文件 8 个测试函数**全部**为 `pass` 空壳(注释「TODO: P16 实现后完善」),
|
||||
依赖不存在的 `activity_factory` / `user_a` / `user_b` 等 fixture(全局无 `conftest.py`),
|
||||
从未执行过,却在 `docs/STATUS.md` 中被计为 P23-T11「活动互选 E2E ✅」。
|
||||
|
||||
计划 Phase 23 Gate:「**不允许 skip/pass 空壳**」。
|
||||
|
||||
当前状态
|
||||
--------
|
||||
本文件现**不含任何测试函数**,pytest 收集 0 个用例。
|
||||
|
||||
仍待真实实现的场景(需求不因移除空壳而丢失)
|
||||
------------------------------------------
|
||||
1. Activity Mutual Interest 不直接创建 Match(INV-014)
|
||||
2. 一方确认不创建 Match(INV-015)
|
||||
3. 双方确认后创建新 Match Episode
|
||||
4. 已有 active Match 时不重复创建(AGENTS.md #19)
|
||||
5. 曾 Unmatch 后重新确认创建新 Episode(AGENTS.md #20)
|
||||
6. 一方拒绝则不创建 Match
|
||||
7. 超时(expires_at)处理
|
||||
8. 单向意向不泄露给对方(INV-006)
|
||||
|
||||
现状补充(Phase 23 实测)
|
||||
------------------------
|
||||
INV-014 / INV-015 在后端已有**真实行为测试**覆盖:
|
||||
`backend/.../activity_mutual/ActivityMutualConsentServiceTest`
|
||||
(双确认 Gate、decline 不建 Match、复用已有 active Match、幂等、超时、软删过滤)。
|
||||
即:E2E 层待补,但不变量本身并非无覆盖。
|
||||
|
||||
真实可执行的 V1.1 E2E 见:`tests/e2e/run_v11_tests.py`
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
class TestActivityMutualConsent:
|
||||
"""活动互选二阶段同意流程测试"""
|
||||
|
||||
def test_mutual_interest_does_not_create_match(self, api_client, activity_factory, user_a, user_b):
|
||||
"""Activity Mutual Interest不直接创建Match(INV-014)"""
|
||||
# TODO: P16 实现后完善
|
||||
# Given: A和B在活动后互选
|
||||
# When: 系统处理互选结果
|
||||
# Then: 不创建Match,创建MutualConnectionConsent
|
||||
pass
|
||||
|
||||
def test_one_side_confirm_no_match(self, api_client, activity_factory, user_a, user_b):
|
||||
"""一方确认不创建Match(INV-015)"""
|
||||
# TODO: P16 实现后完善
|
||||
# Given: A和B已达成Mutual Activity Interest
|
||||
# When: 只有A确认开启沟通
|
||||
# Then: 不创建Match,不创建Conversation
|
||||
pass
|
||||
|
||||
def test_both_confirm_creates_match_episode(self, api_client, activity_factory, user_a, user_b):
|
||||
"""双方确认后创建新Match Episode"""
|
||||
# TODO: P16 实现后完善
|
||||
pass
|
||||
|
||||
def test_existing_active_match_not_duplicated(self, api_client, activity_factory, user_a, user_b):
|
||||
"""已有active Match不重复创建"""
|
||||
# TODO: P16 实现后完善
|
||||
pass
|
||||
|
||||
def test_prior_unmatch_creates_new_episode(self, api_client, activity_factory, user_a, user_b):
|
||||
"""已Unmatch后重新确认创建新Episode"""
|
||||
# TODO: P16 实现后完善
|
||||
pass
|
||||
|
||||
def test_one_side_decline_no_match(self, api_client, activity_factory, user_a, user_b):
|
||||
"""一方拒绝不创建Match"""
|
||||
# TODO: P16 实现后完善
|
||||
pass
|
||||
|
||||
def test_timeout_handled(self, api_client, activity_factory, user_a, user_b):
|
||||
"""超时处理"""
|
||||
# TODO: P16 实现后完善
|
||||
pass
|
||||
|
||||
def test_single_interest_not_leaked(self, api_client, activity_factory, user_a, user_b):
|
||||
"""单向意向不泄露给对方"""
|
||||
# TODO: P16 实现后完善
|
||||
pass
|
||||
|
||||
@@ -1,73 +1,41 @@
|
||||
"""
|
||||
V1.1 婚恋咨询权限 E2E 测试骨架
|
||||
测试项目: Counselor权限隔离、红娘不可见咨询正文
|
||||
V1.1 咨询 / 服务站 / 内容编辑员权限 E2E —— 空壳已移除(Phase 23 KEEP-VERIFY,2026-09-18)
|
||||
|
||||
历史问题
|
||||
--------
|
||||
原文件 10 个测试函数**全部**为 `pass` 空壳(注释「TODO: P13A / P17 / P19 实现后完善」),
|
||||
依赖不存在的 `counselor_client` / `counseling_service_factory` / `content_editor_client`
|
||||
等 fixture(全局无 `conftest.py`),从未执行过,
|
||||
却在 `docs/STATUS.md` 中被计为 P23-T07「咨询权限 ✅」。
|
||||
|
||||
计划 Phase 23 Gate:「**不允许 skip/pass 空壳**」。
|
||||
|
||||
当前状态
|
||||
--------
|
||||
本文件现**不含任何测试函数**,pytest 收集 0 个用例。
|
||||
|
||||
仍待真实实现的场景(需求不因移除空壳而丢失)
|
||||
------------------------------------------
|
||||
1. Counselor 只能看到被分配给自己的咨询(INV-012)
|
||||
2. Counselor 不可查看其他咨询师的服务
|
||||
3. 红娘不可查看咨询正文(INV-013)
|
||||
4. 普通管理员默认不可查看咨询敏感备注
|
||||
5. 咨询管理员可分配咨询人员
|
||||
6. 咨询过程中可转交风控
|
||||
7. 服务站人员不能浏览全平台用户(INV-018)
|
||||
8. 服务站人员可处理本服务站预约
|
||||
9. 内容编辑员不能访问用户婚恋档案(INV-019)
|
||||
10. 内容编辑员可管理文章内容
|
||||
|
||||
现状补充(Phase 23 实测)
|
||||
------------------------
|
||||
- INV-012 已由 `CounselingPhase13ATest` 的 4 个真实用例覆盖;
|
||||
- INV-013 / INV-019 已由 Phase 23 新增的真实行为用例覆盖
|
||||
(`V11InvariantsTest#inv013MatchmakerCannotReadCounselingBody`、
|
||||
`V11InvariantsTest#inv019ContentEditorHasNoUserDataPermission`,
|
||||
走真实 `CounselingService.getDetail`,已通过负向注入验证);
|
||||
- INV-018 已由 `ServiceAppointmentDataScopeTest` 覆盖。
|
||||
即:E2E 层待补,但不变量本身已有真实覆盖。
|
||||
|
||||
真实可执行的 V1.1 E2E 见:`tests/e2e/run_v11_tests.py`
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
class TestCounselingPermission:
|
||||
"""咨询权限测试(INV-012, INV-013)"""
|
||||
|
||||
def test_counselor_only_sees_assigned_services(self, counselor_client, counseling_service_factory):
|
||||
"""Counselor只能看到被分配给自己的咨询(INV-012)"""
|
||||
# GET /api/v1/operator/counseling/services
|
||||
# TODO: P13A 实现后完善
|
||||
pass
|
||||
|
||||
def test_counselor_cannot_view_other_assigned(self, counselor_client, another_counselor_service_factory):
|
||||
"""Counselor不可查看其他咨询师的服务"""
|
||||
# TODO: P13A 实现后完善
|
||||
pass
|
||||
|
||||
def test_matchmaker_cannot_view_counseling_body(self, matchmaker_client, counseling_service_factory):
|
||||
"""红娘不可查看咨询正文(INV-013)"""
|
||||
# TODO: P13A 实现后完善
|
||||
pass
|
||||
|
||||
def test_platform_admin_cannot_view_sensitive_note(self, platform_admin_client, counseling_service_factory):
|
||||
"""普通管理员默认不可查看咨询敏感备注"""
|
||||
# TODO: P13A 实现后完善
|
||||
pass
|
||||
|
||||
def test_counseling_manager_can_assign(self, counseling_manager_client):
|
||||
"""咨询管理员可分配咨询人员"""
|
||||
# POST /api/v1/operator/counseling/services/{id}/assign
|
||||
# TODO: P13A 实现后完善
|
||||
pass
|
||||
|
||||
def test_counseling_risk_referral(self, counselor_client, counseling_service_factory):
|
||||
"""咨询过程中可转交风控"""
|
||||
# TODO: P13A + P17 实现后完善
|
||||
pass
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
class TestServiceAppointmentPermission:
|
||||
"""服务站预约权限测试(INV-018)"""
|
||||
|
||||
def test_service_station_operator_cannot_browse_all_users(self, station_operator_client):
|
||||
"""服务站人员不能浏览全平台用户(INV-018)"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
def test_service_station_operator_can_process_appointments(self, station_operator_client, appointment_factory):
|
||||
"""服务站人员可处理本服务站预约"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
class TestContentEditorPermission:
|
||||
"""内容编辑员权限测试(INV-019)"""
|
||||
|
||||
def test_content_editor_cannot_access_user_profiles(self, content_editor_client):
|
||||
"""内容编辑员不能访问用户婚恋档案(INV-019)"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
def test_content_editor_can_manage_articles(self, content_editor_client):
|
||||
"""内容编辑员可管理文章内容"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
@@ -106,11 +106,18 @@ def test_counselor_assigned_scope():
|
||||
|
||||
|
||||
# ---- INV-013: Matchmaker不能读取Counseling正文 ----
|
||||
def test_matchmaker_cannot_read_counseling_body():
|
||||
"""红娘不得查看咨询正文内容(通过权限隔离)"""
|
||||
# 此测试需要实际的红娘 token,验证其无 counseling.service.view 权限
|
||||
# 在当前测试框架下简化验证:仅确认 Counselor 端点不被普通用户访问
|
||||
pass
|
||||
# Phase 23 KEEP-VERIFY(2026-09-18):原 test_matchmaker_cannot_read_counseling_body
|
||||
# 的函数体为 `pass` 空壳(注释自述「在当前测试框架下简化验证」),从未真实断言过任何权限,
|
||||
# 却在 docs/STATUS.md 中被计为 P23-T06「咨询 E2E ✅」的一部分。
|
||||
# 计划 Phase 23 Gate「不允许 skip/pass 空壳」→ 已移除该空壳。
|
||||
#
|
||||
# INV-013 现由后端真实行为用例覆盖:
|
||||
# backend/.../invariants/V11InvariantsTest#inv013MatchmakerCannotReadCounselingBody
|
||||
# 走真实 CounselingService.getDetail:断言 Matchmaker 读到的 user_request_summary 为 null,
|
||||
# 并以「assigned Counselor 能读到正文」作反证,避免全局脱敏造成的假阳性;
|
||||
# 已通过负向注入验证(把 isMatchmaker 分支改为返回全文 → 该用例精准变红)。
|
||||
#
|
||||
# E2E 层待补场景:用真实红娘 token 调用咨询详情接口并断言被拒。
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
+42
-85
@@ -1,87 +1,44 @@
|
||||
"""
|
||||
V1.1 首页 E2E 测试骨架
|
||||
测试项目: 善缘丹阳 V1.1 首页结构 + Banner + 8核心入口
|
||||
V1.1 首页 E2E —— 空壳已移除(Phase 23 KEEP-VERIFY,2026-09-18)
|
||||
|
||||
历史问题
|
||||
--------
|
||||
原文件 9 个测试函数中 **7 个是 `pass` 空壳**,其余 5 个虽含断言,
|
||||
但全部依赖 `api_client` / `authenticated_user` / `banner_factory` /
|
||||
`user_factory` / `verified_user` / `searching_user` / `paused_user` /
|
||||
`successful_user` / `admin_client` 等**在本仓库中根本不存在**的 pytest fixture
|
||||
(全局无 `conftest.py`)→ 整个文件**一次都没执行过**,
|
||||
却在 `docs/STATUS.md` 中被计为 P23-T01~T04「首页 E2E ✅」。
|
||||
|
||||
计划 Phase 23 Gate:「**不允许 skip/pass 空壳**」。
|
||||
|
||||
当前状态
|
||||
--------
|
||||
本文件现**不含任何测试函数**,pytest 收集 0 个用例。
|
||||
|
||||
仍待真实实现的场景(需求不因移除空壳而丢失)
|
||||
------------------------------------------
|
||||
1. `GET /api/v1/home` 返回 userState
|
||||
2. Banner 按时间过滤(未开始 / 已过期不显示)
|
||||
3. Banner 按 audience_scope 过滤
|
||||
4. 首页 8 核心入口顺序固定(INV-017)
|
||||
5. 未审核用户不返回真实推荐
|
||||
6. Paused 用户不返回新推荐
|
||||
7. Successful 用户不返回找对象推荐
|
||||
8. 服务站可展示
|
||||
9. Banner 不能创建外部 URL 跳转(INV-016)
|
||||
10. `counselingEnabled` flag 控制 `canApplyCounseling`
|
||||
11. Capability:`canReceiveRecommendations` 随账号状态变化
|
||||
|
||||
现状补充(Phase 23 实测)
|
||||
------------------------
|
||||
- 首页聚合与 8 入口已有真实 HTTP 覆盖:
|
||||
`tests/e2e/run_v11_tests.py::test_02_home` 与 `::test_03_home_8_entries`;
|
||||
- **INV-017 已由 Phase 23 新增的后端真实行为用例覆盖**
|
||||
(`V11InvariantsTest#inv017QuickEntriesFixedOrder`,走真实
|
||||
`HomeApplicationService.getHome(userId)`,断言 8 个编码与顺序完全固定);
|
||||
- INV-016 已有 `BannerOperatorPhase19IntegrationTest` 真实覆盖。
|
||||
即:E2E 层待补,但不变量本身已有真实覆盖。
|
||||
|
||||
真实可执行的 V1.1 E2E 见:`tests/e2e/run_v11_tests.py`
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
class TestHomeV11:
|
||||
"""V1.1 首页 E2E 测试"""
|
||||
|
||||
def test_home_api_returns_user_state(self, api_client, authenticated_user):
|
||||
"""GET /api/v1/home 返回 userState"""
|
||||
resp = api_client.get("/api/v1/home")
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert "userState" in data
|
||||
|
||||
def test_home_banners_filtered_by_time(self, api_client, banner_factory):
|
||||
"""Banner按时间过滤:未开始和已过期的Banner不显示"""
|
||||
# TODO: P07 实现后完善
|
||||
pass
|
||||
|
||||
def test_home_banners_filtered_by_audience(self, api_client, banner_factory, user_factory):
|
||||
"""Banner按用户状态过滤:audience_scope不匹配时不显示"""
|
||||
# TODO: P07 实现后完善
|
||||
pass
|
||||
|
||||
def test_home_quick_entries_fixed_order(self, api_client):
|
||||
"""首页8核心入口顺序固定"""
|
||||
# TODO: P07 实现后完善
|
||||
pass
|
||||
|
||||
def test_unverified_user_no_recommendations(self, api_client, unverified_user):
|
||||
"""未审核用户不返回真实推荐"""
|
||||
resp = api_client.get("/api/v1/home")
|
||||
data = resp.json()
|
||||
assert data.get("recommendations") == [] or data.get("recommendations") is None
|
||||
|
||||
def test_paused_user_no_new_recommendations(self, api_client, paused_user):
|
||||
"""Paused状态用户不返回新推荐"""
|
||||
resp = api_client.get("/api/v1/home")
|
||||
data = resp.json()
|
||||
# Paused用户应有推荐区降级提示,而非空列表
|
||||
assert "recommendations" in data or "userState" in data
|
||||
|
||||
def test_successful_user_no_match_recommendations(self, api_client, successful_user):
|
||||
"""Successful用户不返回找对象推荐"""
|
||||
resp = api_client.get("/api/v1/home")
|
||||
data = resp.json()
|
||||
# Successful用户首页应转为公益服务推荐
|
||||
pass
|
||||
|
||||
def test_service_location_shown_when_available(self, api_client, service_location_factory):
|
||||
"""服务站可展示"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
def test_banner_cannot_link_external_url(self, admin_client):
|
||||
"""Banner不能创建外部URL跳转"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
class TestCapabilityService:
|
||||
"""CapabilityService 能力判断测试"""
|
||||
|
||||
def test_can_receive_recommendations(self, api_client, searching_user):
|
||||
"""Searching用户canReceiveRecommendations=true"""
|
||||
resp = api_client.get("/api/v1/home")
|
||||
data = resp.json()
|
||||
caps = data.get("capabilities", {})
|
||||
assert caps.get("canReceiveRecommendations") is True
|
||||
|
||||
def test_paused_user_cannot_receive_recommendations(self, api_client, paused_user):
|
||||
"""Paused用户canReceiveRecommendations=false"""
|
||||
resp = api_client.get("/api/v1/home")
|
||||
data = resp.json()
|
||||
caps = data.get("capabilities", {})
|
||||
assert caps.get("canReceiveRecommendations") is False
|
||||
|
||||
def test_counseling_enabled_capability(self, api_client, verified_user):
|
||||
"""counselingEnabled flag控制canApplyCounseling"""
|
||||
# TODO: P22 实现后完善
|
||||
pass
|
||||
|
||||
@@ -1,72 +1,39 @@
|
||||
"""
|
||||
V1.1 本地资格 E2E 测试骨架
|
||||
测试项目: 本地资格声明 → 佐证上传 → 审核流程
|
||||
V1.1 本地资格 E2E —— 空壳已移除(Phase 23 KEEP-VERIFY,2026-09-18)
|
||||
|
||||
历史问题
|
||||
--------
|
||||
原文件 11 个测试函数**全部**为 `pass` 空壳(注释均为「TODO: P04/P05/P06 实现后完善」),
|
||||
且依赖 `api_client` / `verified_user` / `local_eligibility_factory` 等
|
||||
**在本仓库中根本不存在**的 pytest fixture(全局无 `conftest.py`)。
|
||||
这些用例从未执行过,却在 `docs/STATUS.md` 中被计为 P23-T05「本地资格 E2E ✅」。
|
||||
|
||||
计划 Phase 23 Gate:「**不允许 skip/pass 空壳**」。
|
||||
|
||||
当前状态
|
||||
--------
|
||||
本文件现**不含任何测试函数**,pytest 将收集到 0 个用例 ——
|
||||
以「没有假覆盖」取代「假装有覆盖」。
|
||||
|
||||
仍待真实实现的场景(需求不因移除空壳而丢失)
|
||||
------------------------------------------
|
||||
1. 用户可声明丹阳工作 / 户籍 / 居住
|
||||
2. 声明本地资格不默认要求上传佐证
|
||||
3. 佐证文件上传需要鉴权
|
||||
4. 审核员可访问本地资格佐证(INV-011)
|
||||
5. 红娘不可访问本地资格佐证(INV-011)
|
||||
6. `/me/status` 返回 localEligibilityStatus
|
||||
7. 本地资格未核验影响匹配资格
|
||||
8. 本地资格审核进入 `review_type=local_eligibility` 队列
|
||||
9. 审核通过更新 local_eligibility 状态
|
||||
10. 需补充佐证时触发用户上传
|
||||
11. 查看佐证文件须记录审计日志
|
||||
|
||||
现状补充(Phase 23 实测)
|
||||
------------------------
|
||||
`LocalEligibilityService` 全部方法均以 `userId` 自限定、**无任何 role 分支**,
|
||||
佐证无独立的服务端读取入口(仅经受权限控制的审核队列 `ReviewController` 访问),
|
||||
故 INV-011 在结构上成立;但缺少显式守卫测试,列为遗留待补。
|
||||
|
||||
真实可执行的 V1.1 E2E 见:`tests/e2e/run_v11_tests.py`
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
class TestLocalEligibilityE2E:
|
||||
"""本地资格 E2E 全流程测试"""
|
||||
|
||||
def test_declare_local_eligibility(self, api_client, verified_user):
|
||||
"""用户可声明丹阳工作/户籍/居住"""
|
||||
# POST /api/v1/local-eligibility/declaration
|
||||
# TODO: P04 实现后完善
|
||||
pass
|
||||
|
||||
def test_declare_does_not_require_evidence_by_default(self, api_client, verified_user):
|
||||
"""声明本地资格不默认要求上传佐证"""
|
||||
# TODO: P04 实现后完善
|
||||
pass
|
||||
|
||||
def test_evidence_upload_requires_permission(self, api_client, verified_user):
|
||||
"""佐证文件上传需要鉴权"""
|
||||
# TODO: P04 实现后完善
|
||||
pass
|
||||
|
||||
def test_reviewer_can_access_evidence(self, operator_client, local_eligibility_factory):
|
||||
"""审核员可访问本地资格佐证"""
|
||||
# TODO: P05 实现后完善
|
||||
pass
|
||||
|
||||
def test_matchmaker_cannot_access_evidence(self, matchmaker_client, local_eligibility_factory):
|
||||
"""红娘不可访问本地资格佐证(INV-011)"""
|
||||
# TODO: P13 + P05 实现后完善
|
||||
pass
|
||||
|
||||
def test_local_eligibility_status_in_me_status(self, api_client, verified_user):
|
||||
"""/me/status 返回 localEligibilityStatus"""
|
||||
# TODO: P04 实现后完善
|
||||
pass
|
||||
|
||||
def test_local_eligibility_affects_match_eligibility(self, api_client, user_factory):
|
||||
"""本地资格未核验影响匹配资格"""
|
||||
# TODO: P06 实现后完善
|
||||
pass
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
class TestLocalEligibilityReview:
|
||||
"""本地资格审核流程测试"""
|
||||
|
||||
def test_review_queue_local_eligibility_type(self, operator_client):
|
||||
"""本地资格审核进入 review_type=local_eligibility 队列"""
|
||||
# TODO: P05 实现后完善
|
||||
pass
|
||||
|
||||
def test_approve_updates_eligibility_status(self, operator_client, local_eligibility_factory):
|
||||
"""审核通过更新 local_eligibility 状态"""
|
||||
# TODO: P05 实现后完善
|
||||
pass
|
||||
|
||||
def test_need_evidence_triggers_upload(self, operator_client, local_eligibility_factory):
|
||||
"""需补充佐证触发用户上传"""
|
||||
# TODO: P05 实现后完善
|
||||
pass
|
||||
|
||||
def test_evidence_access_logged(self, operator_client, local_eligibility_factory):
|
||||
"""查看佐证文件记录审计日志"""
|
||||
# TODO: P05 实现后完善
|
||||
pass
|
||||
|
||||
@@ -1,46 +1,35 @@
|
||||
"""
|
||||
V1.1 服务预约 E2E 测试骨架
|
||||
测试项目: 服务预约全流程 + 并发安全
|
||||
V1.1 服务预约 E2E —— 空壳已移除(Phase 23 KEEP-VERIFY,2026-09-18)
|
||||
|
||||
历史问题
|
||||
--------
|
||||
原文件 7 个测试函数**全部**为 `pass` 空壳(注释「TODO: P19 实现后完善」),
|
||||
依赖不存在的 `service_location_factory` / `appointment_factory` / `operator_client`
|
||||
等 fixture(全局无 `conftest.py`),从未执行过,
|
||||
却在 `docs/STATUS.md` 中被计为 P23-T08「服务预约 E2E ✅」。
|
||||
|
||||
计划 Phase 23 Gate:「**不允许 skip/pass 空壳**」。
|
||||
|
||||
当前状态
|
||||
--------
|
||||
本文件现**不含任何测试函数**,pytest 收集 0 个用例。
|
||||
|
||||
仍待真实实现的场景(需求不因移除空壳而丢失)
|
||||
------------------------------------------
|
||||
1. 用户可提交服务预约
|
||||
2. 预约提交支持幂等(Idempotency-Key)
|
||||
3. 后台可确认预约
|
||||
4. 同一预约同时取消与确认的并发安全性
|
||||
5. 我的预约列表正确
|
||||
6. 待确认状态可取消
|
||||
7. 已确认状态不可自行取消
|
||||
|
||||
现状补充(Phase 23 实测)
|
||||
------------------------
|
||||
预约 owner 归属与数据范围已有真实后端测试:
|
||||
`ServiceAppointmentOwnerGuardTest`、`ServiceAppointmentDataScopeTest`。
|
||||
预约创建链路在 `tests/e2e/run_v11_tests.py::test_06_service_appointment`
|
||||
中有真实 HTTP 覆盖。E2E 层其余场景待补。
|
||||
|
||||
真实可执行的 V1.1 E2E 见:`tests/e2e/run_v11_tests.py`
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
class TestServiceAppointmentE2E:
|
||||
"""服务预约 E2E 测试"""
|
||||
|
||||
def test_submit_appointment(self, api_client, service_location_factory):
|
||||
"""用户可提交服务预约"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
def test_appointment_idempotent(self, api_client, service_location_factory):
|
||||
"""预约提交支持幂等(Idempotency-Key)"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
def test_operator_can_confirm(self, operator_client, appointment_factory):
|
||||
"""后台可确认预约"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
def test_appointment_concurrent_safety(self, api_client, service_location_factory):
|
||||
"""同一预约同时取消和确认的并发安全性"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
def test_my_appointments_list(self, api_client, appointment_factory):
|
||||
"""我的预约列表正确"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
def test_cancel_before_confirmation(self, api_client, appointment_factory):
|
||||
"""待确认状态可取消"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
def test_cancel_after_confirmation_denied(self, api_client, appointment_factory):
|
||||
"""已确认状态不可自行取消"""
|
||||
# TODO: P19 实现后完善
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user