Files
cms-SiteForge/tests/test_v828_launch_center.py
T
浅念 8884e100f9 upgrade: adopt V8.31.1 (theme 1.3/1.4 redesigns, editor deep-canvas, guided launch, component library)
Overlay 190 upstream items (V8.22→8.31) preserving trade-pro theme,
registry tests, and design docs. Re-applied full patch set on identical
anchors (discovery/env_for/blocks.css/type-mapping/locale-override/
theme_color/frontend entries/test_theme_pro_v3 mods) plus compose pins.

Verified: theme suites 35/35; dual-baseline full run 415 passed vs
pristine 386+29 ours, FAILED-set diff EMPTY (same 10 Windows env fails).
Live: container 8.31.1-dev.1 healthy, hesupipe 192 entries intact,
trade-pro build 203 pages 0 errors.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-26 09:43:17 +08:00

38 lines
1.9 KiB
Python

"""V8.28: secured user journey remains mapped to existing FastAPI controls."""
from pathlib import Path
from test_factory import client
ROOT=Path(__file__).resolve().parents[1]
def test_launch_center_is_reachable_from_workspace(client):
response=client.get('/')
assert response.status_code==200
assert 'data-view="launch"' in response.text
assert '检查并上线' in response.text
assert '/ui/workspace-launch.js' in response.text
assert client.get('/ui/workspace-launch.js').status_code==200
def test_steps_use_existing_production_api_and_preserve_csrf(client):
script=client.get('/ui/workspace.js').text
for name in ('function launch()', 'function launchRequestApproval()', 'function launchPreflight()', 'function launchDeploy()', 'function resetLaunch()'):
assert name in script
for route in ('/release-requests', '/preflight/', '/deploy'):
assert route in script
assert "headers['X-SiteForge-CSRF']=state.csrf" in script
assert 'Idempotency-Key' in script
assert '已经检查此版本' in script
assert '提交部署只是创建任务' in script
def test_preflight_for_nonexistent_build_is_not_marked_ready(client):
# The administrative fixture is a superadmin. Missing builds must still fail closed.
result=client.get('/api/production/sites/not-your-website/preflight/something')
assert result.status_code in (403,404) or (result.status_code==200 and result.json().get('ready') is False)
def test_new_client_side_gates_do_not_change_server_approval_requirement(client):
site=client.post('/api/sites',json={'name':'V828 审批保护','theme':'corporate','mode':'new'})
assert site.status_code==201
sid=site.json()['id']
# Unauthorized to deploy a nonexistent or unapproved version, even if client is bypassed.
response=client.post(f'/api/production/sites/{sid}/deploy',json={'build_id':'fake-build','target':'production'})
assert response.status_code in (400,403,404,409,503)