@@ -154,3 +154,58 @@ def test_env_var_set():
154154 with f ("CJDK_TEST_ENV_VAR" , "testvalue" ):
155155 assert os .environ ["CJDK_TEST_ENV_VAR" ] == "testvalue"
156156 assert "CJDK_TEST_ENV_VAR" not in os .environ
157+
158+
159+ def test_list_vendors (tmp_path ):
160+ with mock_server .start (
161+ endpoint = "/index.json" ,
162+ data = {
163+ "linux" : {
164+ "amd64" : {
165+ "jdk@adoptium" : {"17" : "zip+http://example.com/a.zip" },
166+ "jdk@zulu" : {"17" : "zip+http://example.com/z.zip" },
167+ },
168+ "arm64" : {
169+ "jdk@adoptium" : {"17" : "zip+http://example.com/a.zip" },
170+ },
171+ },
172+ "darwin" : {
173+ "amd64" : {
174+ "jdk@graalvm" : {"17" : "zip+http://example.com/g.zip" },
175+ },
176+ },
177+ },
178+ ) as server :
179+ vendors_linux_amd64 = _api .list_vendors (
180+ os = "linux" ,
181+ arch = "amd64" ,
182+ cache_dir = tmp_path / "cache" ,
183+ index_url = server .url ("/index.json" ),
184+ _allow_insecure_for_testing = True ,
185+ )
186+ vendors_linux_arm64 = _api .list_vendors (
187+ os = "linux" ,
188+ arch = "arm64" ,
189+ cache_dir = tmp_path / "cache" ,
190+ index_url = server .url ("/index.json" ),
191+ _allow_insecure_for_testing = True ,
192+ )
193+ vendors_darwin_amd64 = _api .list_vendors (
194+ os = "darwin" ,
195+ arch = "amd64" ,
196+ cache_dir = tmp_path / "cache" ,
197+ index_url = server .url ("/index.json" ),
198+ _allow_insecure_for_testing = True ,
199+ )
200+ vendors_nonexistent = _api .list_vendors (
201+ os = "windows" ,
202+ arch = "amd64" ,
203+ cache_dir = tmp_path / "cache" ,
204+ index_url = server .url ("/index.json" ),
205+ _allow_insecure_for_testing = True ,
206+ )
207+
208+ assert vendors_linux_amd64 == ["adoptium" , "zulu" ]
209+ assert vendors_linux_arm64 == ["adoptium" ]
210+ assert vendors_darwin_amd64 == ["graalvm" ]
211+ assert vendors_nonexistent == []
0 commit comments