@@ -16,12 +16,10 @@ def route_methods():
1616
1717def test_cloud_run_route_contracts_are_registered ():
1818 assert route_methods () == {
19- "/" : ["GET" , "POST" ],
19+ "/" : ["GET" ],
2020 "/profiles" : ["GET" ],
2121 "/smoke" : ["GET" ],
22- "/session-check" : ["GET" , "POST" ],
2322 "/run" : ["GET" , "POST" ],
24- "/precheck" : ["GET" , "POST" ],
2523 "/dry-run" : ["GET" , "POST" ],
2624 "/probe" : ["GET" , "POST" ],
2725 "/static/<path:filename>" : ["GET" ],
@@ -68,17 +66,17 @@ def test_run_endpoint_calls_strategy_cycle_when_gate_enabled(monkeypatch):
6866 assert response .get_json () == {"ok" : True , "action_done" : False }
6967
7068
71- def test_session_check_endpoint_is_disabled_without_explicit_http_gate (monkeypatch ):
69+ def test_probe_endpoint_is_disabled_without_explicit_http_gate (monkeypatch ):
7270 monkeypatch .delenv ("FIRSTRADE_RUN_SESSION_CHECK_ON_HTTP" , raising = False )
7371 client = main .app .test_client ()
7472
75- response = client .get ("/session-check " )
73+ response = client .get ("/probe " )
7674
7775 assert response .status_code == 403
7876 assert response .get_json ()["ok" ] is False
7977
8078
81- def test_session_check_endpoint_calls_service_when_gate_enabled (monkeypatch ):
79+ def test_probe_endpoint_calls_service_when_gate_enabled (monkeypatch ):
8280 monkeypatch .setenv ("FIRSTRADE_RUN_SESSION_CHECK_ON_HTTP" , "true" )
8381 sent_messages = []
8482 monkeypatch .setattr (
@@ -89,7 +87,7 @@ def test_session_check_endpoint_calls_service_when_gate_enabled(monkeypatch):
8987 monkeypatch .setattr (main , "build_sender" , lambda * _args , ** _kwargs : sent_messages .append )
9088 client = main .app .test_client ()
9189
92- response = client .post ("/session-check " )
90+ response = client .post ("/probe " )
9391
9492 assert response .status_code == 200
9593 assert response .get_json () == {
@@ -100,26 +98,7 @@ def test_session_check_endpoint_calls_service_when_gate_enabled(monkeypatch):
10098 assert sent_messages == []
10199
102100
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-
122- def test_session_check_endpoint_notifies_only_on_error (monkeypatch ):
101+ def test_probe_endpoint_notifies_only_on_error (monkeypatch ):
123102 monkeypatch .setenv ("FIRSTRADE_RUN_SESSION_CHECK_ON_HTTP" , "true" )
124103 monkeypatch .setenv ("TELEGRAM_TOKEN" , "token-1" )
125104 monkeypatch .setenv ("GLOBAL_TELEGRAM_CHAT_ID" , "chat-1" )
@@ -139,7 +118,7 @@ def send(message):
139118 monkeypatch .setattr (main , "build_sender" , fake_build_sender )
140119 client = main .app .test_client ()
141120
142- response = client .post ("/session-check " )
121+ response = client .post ("/probe " )
143122
144123 assert response .status_code == 500
145124 payload = response .get_json ()
@@ -152,17 +131,6 @@ def send(message):
152131 assert "RuntimeError: session denied" in sent_messages [0 ][2 ]
153132
154133
155- def test_root_post_calls_strategy_cycle_when_gate_enabled (monkeypatch ):
156- monkeypatch .setenv ("FIRSTRADE_RUN_STRATEGY_ON_HTTP" , "true" )
157- monkeypatch .setattr (main , "_run_strategy_cycle_with_report" , lambda ** _kwargs : {"ok" : True , "action_done" : False })
158- client = main .app .test_client ()
159-
160- response = client .post ("/" )
161-
162- assert response .status_code == 200
163- assert response .get_json () == {"ok" : True , "action_done" : False }
164-
165-
166134def test_run_endpoint_notifies_telegram_on_strategy_cycle_error (monkeypatch ):
167135 sent_messages = []
168136
@@ -266,12 +234,9 @@ def fake_run_strategy_cycle_with_report(**kwargs):
266234 monkeypatch .setattr (main , "run_session_check" , lambda : {"ok" : True , "session_reused" : True })
267235 client = main .app .test_client ()
268236
269- precheck_response = client .post ("/precheck" )
270237 dry_run_response = client .post ("/dry-run" )
271238 probe_response = client .post ("/probe" )
272239
273- assert precheck_response .status_code == 200
274- assert precheck_response .get_json ()["ok" ] is True
275240 assert dry_run_response .status_code == 200
276241 assert dry_run_response .get_json ()["ok" ] is True
277242 assert observed == {
0 commit comments