APK alternatives: refresh the catalogue after an install job; pin the test's premise

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-28 17:29:29 +10:00
1 parent c814cb95d0
commit 224340edc9
2 files changed
+11 -4

No files matched your search

+8 -3
View File
@@ -213,8 +213,13 @@ class ServerGuards(unittest.TestCase):
self.assertNotIn("job", body)
def test_android_install_of_another_version_runs_as_a_job(self):
status, started = self.post("/api/android", {"action": "install", "package": "org.example.app",
"url": "https://f-droid.org/repo/org.example.app_1.apk"})
pkg = "org.example.frame_control.not_in_any_repo"
sys.path.insert(0, str(ROOT / "ui"))
import frame_apk_versions
# The job must fail on the cached lookup, before any download: nothing is cached for this package.
self.assertEqual(frame_apk_versions._versions(pkg, cached_only=True)[0], [])
status, started = self.post("/api/android", {"action": "install", "package": pkg,
"url": f"https://f-droid.org/repo/{pkg}_1.apk"})
self.assertEqual(status, 200, started)
for _ in range(200):
job = json.loads(self.request("GET", f"/api/job?id={started['job']}", headers={"X-Frame-UI": "1"})[2])
@@ -222,7 +227,7 @@ class ServerGuards(unittest.TestCase):
break
time.sleep(0.05)
self.assertTrue(job["done"])
self.assertIn("no longer available", job["error"]) # nothing cached for this package
self.assertIn("no longer available", job["error"])
def test_unknown_routes(self):
self.assertEqual(self.request("GET", "/nope")[0], 404)
+3 -1
View File
@@ -1462,7 +1462,9 @@ function showApkAlternatives(reason, result) {
const res = await runJob(`Install ${result.package} ${v.version}`, result.package, () => api("/api/android", {
action: "install", package: result.package, url: v.url
}));
if (res) { $("apkAltDlg").close(); loadAndroid(); } else { b.disabled = false; b.textContent = "Install"; }
if (res) $("apkAltDlg").close(); else { b.disabled = false; b.textContent = "Install"; }
await loadAndroid();
if (cat.apps) { const y = window.scrollY; filterCatalog(); window.scrollTo(0, y); }
};
if (!$("apkAltDlg").open) $("apkAltDlg").showModal();
}