feat: use system curl for cmhub image downloads

This commit is contained in:
chengma
2026-07-08 09:26:25 +08:00
parent 4a499a17d1
commit cff61edce4
11 changed files with 355 additions and 9 deletions
+33
View File
@@ -101,6 +101,39 @@ class AppConfigTests(TempDirMixin, unittest.TestCase):
self.assert_removed(temp_dir)
def test_cmhub_download_with_curl_mode_is_normalized(self):
with self.make_temp_dir() as temp_dir:
config_path = os.path.join(temp_dir, "config.json")
config = appconfig.load_config(config_path)
self.assertEqual("auto", appconfig.cmhub_config(config)["download_with_curl"])
saved = appconfig.save_config(
{
"ai": {
"cmhub": {
"download_with_curl": True,
}
}
},
path=config_path,
)
self.assertEqual("true", appconfig.cmhub_config(saved)["download_with_curl"])
saved = appconfig.save_config(
{
"ai": {
"cmhub": {
"download_with_curl": "invalid",
}
}
},
path=config_path,
)
self.assertEqual("auto", appconfig.cmhub_config(saved)["download_with_curl"])
self.assert_removed(temp_dir)
def test_data_paths_resolve_under_default_data_dir(self):
with self.make_temp_dir() as temp_dir:
data_root = os.path.join(temp_dir, "data")