"""The /api/design blueprint — this install's UI, not the design-system record. Modelled on tests/test_routes_design_systems.py. The URL enumeration is deliberate rather than a pattern match: this blueprint was repointed from `/expectations` to `/ui-system` (#2419), and the failure worth catching is the old rule surviving the change — a route nothing serves any more, answering with whatever the last handler registered on it did. """ import inspect import pytest def test_design_blueprint_registered(): from scribe.routes.design import design_bp assert design_bp.name == "design" assert design_bp.url_prefix == "/api/design" def test_design_blueprint_registered_in_app(): from scribe.app import create_app app = create_app() assert "design" in app.blueprints def test_the_blueprint_serves_exactly_one_rule(): from scribe.app import create_app app = create_app() rules = { str(r.rule) for r in app.url_map.iter_rules() if r.endpoint.startswith("design.") } assert rules == {"/api/design/ui-system"} def test_the_designation_reader_takes_user_id(): """The setting is per-user, so the read must be too (rule #78). A module-level or admin-scoped read would hand one user another's designation.""" from scribe.services import design_systems as svc assert "user_id" in inspect.signature(svc.ui_design_system).parameters def test_the_setting_key_is_the_new_one(): """Named explicitly because the panel silently reading a retired key is the exact shape of the bug this replaced: a feature that renders, and reports nothing, forever.""" from scribe.services.design_systems import UI_DESIGN_SYSTEM_SETTING assert UI_DESIGN_SYSTEM_SETTING == "ui_design_system_id" def test_the_rulebook_expectation_extractor_is_gone(): """It was retired with the rulebook it parsed (#2288, #2419). Left importable it would keep looking like a live path to the next reader.""" with pytest.raises(ModuleNotFoundError): import scribe.services.design_rulebook_import # noqa: F401