@@ -142,6 +142,41 @@ def test_call_ai_feedback_accepts_whitelisted_url(monkeypatch):
142142 assert results ["Test A" ]["status" ] == "success"
143143
144144
145+ def test_call_ai_feedback_rejects_non_remote_model ():
146+ """Non-remote models (e.g., cloud AIs) should be blocked."""
147+ parent_dir = str (Path (__file__ ).resolve ().parent )
148+ spec = {
149+ "tester_type" : "ai" ,
150+ "env_data" : {"ai_feedback_version" : "main" },
151+ "test_data" : {
152+ "category" : ["instructor" ],
153+ "config" : {
154+ "model" : "openai" ,
155+ "prompt" : "code_table" ,
156+ "scope" : "code" ,
157+ "submission" : parent_dir + "/fixtures/sample_submission.py" ,
158+ "submission_type" : "python" ,
159+ },
160+ "extra_info" : {
161+ "name" : "AI FEEDBACK COMMENTS" ,
162+ "display_output" : "instructors" ,
163+ "test_group_id" : 17 ,
164+ "criterion" : None ,
165+ },
166+ "output" : "overall_comment" ,
167+ "timeout" : 30 ,
168+ "test_label" : "Test A" ,
169+ },
170+ "_env" : {"PYTHON" : "/home/docker/.autotesting/scripts/128/ai_1/bin/python3" },
171+ }
172+ import json as _json
173+ tester = AiTester (specs = TestSpecs .from_json (_json .dumps (spec )))
174+ results = tester .call_ai_feedback ()
175+ assert results ["Test A" ]["status" ] == "error"
176+ assert "Unsupported model type" in results ["Test A" ]["message" ]
177+ assert "openai" in results ["Test A" ]["message" ]
178+
179+
145180def test_call_ai_feedback_empty_whitelist (mock_whitelist_config ):
146181 """When no URLs are configured in settings, all remote URLs should be rejected."""
147182 mock_whitelist_config .get .side_effect = lambda key , default = None : (
0 commit comments