From ca799cc5e5181faa743dffefe45dd742503a666b Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 7 Jul 2026 12:06:02 +0000 Subject: [PATCH] =?UTF-8?q?Scenarios=20outside=20the=20portfolio=20refuse?= =?UTF-8?q?=20the=20run=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- .../app/modelling/test_trigger_run_router.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/backend/app/modelling/test_trigger_run_router.py b/tests/backend/app/modelling/test_trigger_run_router.py index 9da1405f2..30ebb17b7 100644 --- a/tests/backend/app/modelling/test_trigger_run_router.py +++ b/tests/backend/app/modelling/test_trigger_run_router.py @@ -131,6 +131,22 @@ def test_trigger_run_rejects_filters_that_match_no_properties(api: Api) -> None: assert api.subtasks_for(task) == [] +def test_trigger_run_rejects_scenarios_outside_the_portfolio(api: Api) -> None: + # arrange — one valid scenario, one belonging to a different portfolio + task = api.seed_task() + ours = api.seed_scenario() + theirs = api.seed_scenario(portfolio_id=999) + api.seed_property() + + # act + response = _trigger(api, task, [ours, theirs]) + + # assert — refused outright; nothing partially distributed + assert response.status_code == 400 + assert api.sent_bodies == [] + assert api.subtasks_for(task) == [] + + def test_trigger_run_fans_out_one_subtask_and_message_per_scenario_batch( api: Api, ) -> None: