@@ -1221,6 +1221,37 @@ def fake_wait_for(resolve, *_args):
12211221 assert calls .count (("GET" , "/api/v1/status" )) == 2
12221222
12231223
1224+ def test_add_transfer_accepts_bulk_items_response_without_contract_gate (monkeypatch ) -> None :
1225+ module = load_suite_module ()
1226+ expected_hash = "9eced47df2edfbd72f29f93447d60b7b"
1227+ item = {"hash" : expected_hash .upper (), "name" : "deterministic-two-client-transfer.bin" , "ok" : True }
1228+ response = {
1229+ "status" : 200 ,
1230+ "content_type" : "application/json; charset=utf-8" ,
1231+ "json" : {"items" : [item ]},
1232+ "raw_json" : {"data" : {"items" : [item ]}, "meta" : {"apiVersion" : "v1" }},
1233+ }
1234+ calls : list [tuple [str , str , dict [str , object ]]] = []
1235+
1236+ def fake_http_request (_base_url , path , * , method = "GET" , json_body = None , ** _kwargs ):
1237+ calls .append ((method , path , dict (json_body or {})))
1238+ return response
1239+
1240+ monkeypatch .setattr (module .rest_smoke , "http_request" , fake_http_request )
1241+ monkeypatch .setattr (module .rest_smoke , "compact_http_result" , lambda result : {"status" : result ["status" ], "json" : result ["json" ]})
1242+
1243+ result = module .add_transfer ("http://127.0.0.1:4711" , "key" , "ed2k://|file|a|1|9ECED47DF2EDFBD72F29F93447D60B7B|/" , expected_hash )
1244+
1245+ assert result ["item" ] == item
1246+ assert calls == [
1247+ (
1248+ "POST" ,
1249+ "/api/v1/transfers" ,
1250+ {"link" : "ed2k://|file|a|1|9ECED47DF2EDFBD72F29F93447D60B7B|/" , "paused" : False , "categoryId" : 0 },
1251+ )
1252+ ]
1253+
1254+
12241255def test_wait_for_completed_file_timeout_carries_diagnostic_observations (tmp_path : Path ) -> None :
12251256 module = load_suite_module ()
12261257 snapshots = [{"transfer" : {"status" : 200 , "json" : {"state" : "downloading" }}}]
0 commit comments