mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
fix(content): anti-soup guard on pitch slug + restore pitch test intent
Sweep found pitch slug was the one content-tool free-text field still outside the anti-soup guard (a product could be slugged 'wip'/'asdf'). Add it to the guard (min 2, so real short slugs like 'ui' pass). Also fix two pitch tests that were false-passing on a 1-char title (the title guard rejected first): give them substantive fields so they actually exercise the role gate (not_authorized) and the non-cell-target rejection (invalid_state).
This commit is contained in:
@@ -610,6 +610,7 @@ class ContentActions:
|
|||||||
"""
|
"""
|
||||||
for _pf, _pv, _min in (
|
for _pf, _pv, _min in (
|
||||||
("title", title, 5),
|
("title", title, 5),
|
||||||
|
("slug", slug, 2),
|
||||||
("problem", problem, 15),
|
("problem", problem, 15),
|
||||||
("proposed_solution", proposed_solution, 15),
|
("proposed_solution", proposed_solution, 15),
|
||||||
):
|
):
|
||||||
|
|||||||
@@ -29,15 +29,17 @@ def _actions(role: str) -> ContentActions:
|
|||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_pitch_forbidden_for_non_board() -> None:
|
async def test_pitch_forbidden_for_non_board() -> None:
|
||||||
|
# Substantive fields so the soup guard passes and the ROLE gate is what
|
||||||
|
# rejects (a developer may not pitch) — not an incidental short-field fail.
|
||||||
env = await _actions("developer").pitch(
|
env = await _actions("developer").pitch(
|
||||||
agent_id=uuid4(),
|
agent_id=uuid4(),
|
||||||
title="T",
|
title="A self-serve widget catalog",
|
||||||
slug="t",
|
slug="widget-catalog",
|
||||||
problem="p",
|
problem="customers cannot browse widgets without an account",
|
||||||
proposed_solution="s",
|
proposed_solution="add a public widget catalog with search",
|
||||||
target_cells=["backend"],
|
target_cells=["backend"],
|
||||||
)
|
)
|
||||||
assert env.error is not None
|
assert env.error == "not_authorized"
|
||||||
assert env.status is None
|
assert env.status is None
|
||||||
|
|
||||||
|
|
||||||
@@ -63,12 +65,14 @@ async def test_pitch_creates_for_board(monkeypatch: pytest.MonkeyPatch) -> None:
|
|||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_pitch_rejects_non_cell_target() -> None:
|
async def test_pitch_rejects_non_cell_target() -> None:
|
||||||
|
# Substantive fields so the soup guard passes and the non-cell TARGET is
|
||||||
|
# what rejects (a pitch can only target cells, not the board).
|
||||||
env = await _actions("head_marketing").pitch(
|
env = await _actions("head_marketing").pitch(
|
||||||
agent_id=uuid4(),
|
agent_id=uuid4(),
|
||||||
title="T",
|
title="A self-serve widget catalog",
|
||||||
slug="t",
|
slug="widget-catalog",
|
||||||
problem="p",
|
problem="customers cannot browse widgets without an account",
|
||||||
proposed_solution="s",
|
proposed_solution="add a public widget catalog with search",
|
||||||
target_cells=["board"],
|
target_cells=["board"],
|
||||||
)
|
)
|
||||||
assert env.error is not None
|
assert env.error == "invalid_state"
|
||||||
|
|||||||
Reference in New Issue
Block a user