CI / Formatação e clippy (push) Successful in 20s
CI / Auditoria de dependências (push) Successful in 9s
CI / Compila o app desktop (Linux) (push) Successful in 1m55s
Release / Cria a release (push) Successful in 5s
CI / Testes (Linux) (push) Successful in 4m25s
Release / CLI (linux-aarch64) (push) Successful in 2m18s
Release / CLI (linux-x86_64) (push) Successful in 2m51s
Release / App desktop (linux-aarch64) (push) Successful in 9m19s
Release / App desktop (linux-x86_64) (push) Failing after 11m11s
Release / App desktop (windows) (push) Successful in 10m27s
Release / Monta o latest.json (push) Skipped
56 lines
2.1 KiB
Python
56 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Teste de scripts/make-latest-json.py: python3 scripts/test_make_latest_json.py"""
|
|
import importlib.util
|
|
import os
|
|
import sys
|
|
import unittest
|
|
|
|
sys.dont_write_bytecode = True
|
|
|
|
spec = importlib.util.spec_from_file_location("m", os.path.join(os.path.dirname(__file__), "make-latest-json.py"))
|
|
m = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(m)
|
|
|
|
BASE = "https://git.lucasrguerra.dev.br/lucasrguerra/guara/releases/download/v1.3.2/"
|
|
|
|
|
|
def assets(version="1.3.2"):
|
|
names = [patterns[0].format(v=version) for _, patterns in m.PLATFORMS]
|
|
return {n: (BASE + n, f"assinatura-de-{n}\n") for n in names}
|
|
|
|
|
|
class LatestJson(unittest.TestCase):
|
|
def test_all_platforms_and_variants(self):
|
|
d = m.build("1.3.2", "### Novidades\n", assets(), "2026-10-30T12:00:00Z")
|
|
self.assertEqual(d["version"], "1.3.2")
|
|
self.assertEqual(d["notes"], "### Novidades")
|
|
p = d["platforms"]
|
|
for k in ("linux-x86_64", "linux-x86_64-appimage", "linux-aarch64", "windows-x86_64", "windows-x86_64-nsis"):
|
|
self.assertIn(k, p)
|
|
self.assertTrue(p["windows-x86_64"]["url"].endswith("x64-setup.exe"))
|
|
self.assertEqual(p["linux-x86_64"]["signature"], "assinatura-de-Guará_1.3.2_amd64.AppImage")
|
|
|
|
def test_missing_package_is_left_out(self):
|
|
a = assets()
|
|
del a["Guará_1.3.2_x64-setup.exe"]
|
|
d = m.build("1.3.2", "", a, "2026-10-30T12:00:00Z")
|
|
self.assertNotIn("windows-x86_64", d["platforms"])
|
|
self.assertIn("linux-x86_64", d["platforms"])
|
|
|
|
def test_other_versions_do_not_leak(self):
|
|
d = m.build("1.3.2", "", assets("1.2.0"), "2026-10-30T12:00:00Z")
|
|
self.assertEqual(d["platforms"], {})
|
|
|
|
def test_accepts_legacy_unaccented_name(self):
|
|
a = assets()
|
|
old = "Guara_1.3.2_amd64.AppImage"
|
|
_, sig = a.pop("Guará_1.3.2_amd64.AppImage")
|
|
a[old] = (BASE + old, sig)
|
|
d = m.build("1.3.2", "", a, "2026-10-30T12:00:00Z")
|
|
self.assertIn("linux-x86_64", d["platforms"])
|
|
self.assertTrue(d["platforms"]["linux-x86_64"]["url"].endswith(old))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|