mirror of
https://github.com/Felitendo/spotifast.git
synced 2026-11-01 17:33:26 +01:00
Publish canonical AUR, Homebrew and native package names while retaining existing application identities and updater-compatible archives. Announce the AUR move in packaging-only revisions of the old packages. Keep 0.8.0 application bytes unchanged. Cover both release filename sets in checksums and validate native Linux package replacement against pinned old-package fixtures.
49 lines
2.1 KiB
Python
49 lines
2.1 KiB
Python
import importlib.util
|
|
from pathlib import Path
|
|
import tempfile
|
|
import sys
|
|
import unittest
|
|
|
|
sys.dont_write_bytecode = True
|
|
|
|
spec = importlib.util.spec_from_file_location("release_names", Path(__file__).with_name("release-names.py"))
|
|
release_names = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(release_names)
|
|
|
|
|
|
class ReleaseNamesTest(unittest.TestCase):
|
|
def test_old_and_new_inputs_keep_their_bytes_and_checksums(self):
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
root = Path(directory)
|
|
(root / "fastpotify-v0.8.0-linux.tar.gz").write_bytes(b"unchanged Linux build")
|
|
(root / "spotifast-v0.8.0-macos.dmg").write_bytes(b"notarized Mac build")
|
|
release_names.prepare(root, "v0.8.0")
|
|
self.assertEqual((root / "spotifast-v0.8.0-linux.tar.gz").read_bytes(), b"unchanged Linux build")
|
|
self.assertEqual((root / "fastpotify-v0.8.0-macos.dmg").read_bytes(), b"notarized Mac build")
|
|
before = (root / "checksums.txt").read_bytes()
|
|
self.assertEqual(len(before.splitlines()), 4)
|
|
release_names.prepare(root, "v0.8.0")
|
|
self.assertEqual((root / "checksums.txt").read_bytes(), before)
|
|
|
|
def test_conflicting_inputs_fail_without_replacing_either_file(self):
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
root = Path(directory)
|
|
old = root / "fastpotify-v0.8.0-linux.tar.gz"
|
|
new = root / "spotifast-v0.8.0-linux.tar.gz"
|
|
old.write_bytes(b"old")
|
|
new.write_bytes(b"new")
|
|
with self.assertRaisesRegex(ValueError, "Different bytes"):
|
|
release_names.prepare(root, "v0.8.0")
|
|
self.assertEqual(old.read_bytes(), b"old")
|
|
self.assertEqual(new.read_bytes(), b"new")
|
|
self.assertFalse((root / "checksums.txt").exists())
|
|
|
|
def test_missing_inputs_fail(self):
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
with self.assertRaisesRegex(ValueError, "No release"):
|
|
release_names.prepare(Path(directory), "v0.8.0")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|