@@ -22,6 +22,7 @@ def test_cloud_run_route_contracts_are_registered():
2222 "/session-check" : ["GET" , "POST" ],
2323 "/run" : ["GET" , "POST" ],
2424 "/precheck" : ["GET" , "POST" ],
25+ "/dry-run" : ["GET" , "POST" ],
2526 "/probe" : ["GET" , "POST" ],
2627 "/static/<path:filename>" : ["GET" ],
2728 }
@@ -99,6 +100,25 @@ def test_session_check_endpoint_calls_service_when_gate_enabled(monkeypatch):
99100 assert sent_messages == []
100101
101102
103+ def test_probe_alias_calls_session_check_service_when_gate_enabled (monkeypatch ):
104+ monkeypatch .setenv ("FIRSTRADE_RUN_SESSION_CHECK_ON_HTTP" , "true" )
105+ monkeypatch .setattr (
106+ main ,
107+ "run_session_check" ,
108+ lambda : {"ok" : True , "session_reused" : False , "snapshot_persisted" : True },
109+ )
110+ client = main .app .test_client ()
111+
112+ response = client .post ("/probe" )
113+
114+ assert response .status_code == 200
115+ assert response .get_json () == {
116+ "ok" : True ,
117+ "session_reused" : False ,
118+ "snapshot_persisted" : True ,
119+ }
120+
121+
102122def test_session_check_endpoint_notifies_only_on_error (monkeypatch ):
103123 monkeypatch .setenv ("FIRSTRADE_RUN_SESSION_CHECK_ON_HTTP" , "true" )
104124 monkeypatch .setenv ("TELEGRAM_TOKEN" , "token-1" )
@@ -241,17 +261,23 @@ def fake_run_strategy_cycle_with_report(**kwargs):
241261 observed .update (kwargs )
242262 return {"ok" : True , "action_done" : False }
243263
264+ monkeypatch .setenv ("FIRSTRADE_RUN_SESSION_CHECK_ON_HTTP" , "true" )
244265 monkeypatch .setattr (main , "_run_strategy_cycle_with_report" , fake_run_strategy_cycle_with_report )
266+ monkeypatch .setattr (main , "run_session_check" , lambda : {"ok" : True , "session_reused" : True })
245267 client = main .app .test_client ()
246268
247269 precheck_response = client .post ("/precheck" )
270+ dry_run_response = client .post ("/dry-run" )
248271 probe_response = client .post ("/probe" )
249272
250273 assert precheck_response .status_code == 200
251274 assert precheck_response .get_json ()["ok" ] is True
275+ assert dry_run_response .status_code == 200
276+ assert dry_run_response .get_json ()["ok" ] is True
252277 assert observed == {
253278 "dry_run_override" : True ,
254279 "send_cycle_notification" : False ,
255280 "dispatch_plugin_alerts" : False ,
256281 }
257282 assert probe_response .status_code == 200
283+ assert probe_response .get_json ()["ok" ] is True
0 commit comments