fix: prefer changelog over Game.ini in census sidecar scan

This commit is contained in:
ginnoir committed 2026-08-14 14:51:03 -05:00
1 parent 25eee44483
commit cbe1848d10
5 files changed
+29 -12

No files matched your search

+11
View File
@@ -1,4 +1,5 @@
import hashlib, os, sys, tempfile, unittest, zipfile
from unittest.mock import patch
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
sys.path.insert(0, os.path.join(ROOT, "scripts"))
from update_swarm.census import census_job
@@ -19,6 +20,16 @@ class TestCensus(unittest.TestCase):
self.assertEqual(rec["installed_version"], "1.74.1")
self.assertEqual(rec["source"], "file")
@patch(
"update_swarm.census.os.listdir",
return_value=["Game.ini", "changelog.txt", "dummy.bin"],
)
def test_sidecar_prefers_changelog_over_game_ini(self, _listdir):
rec = census_job(job("B"), os.path.join(FIX, "both-sidecars", "dummy.bin"))
self.assertEqual(rec["installed_version"], "3.3.1")
self.assertEqual(rec["source"], "file")
self.assertEqual(rec["evidence"], "sidecar")
def test_filename_token(self):
rec = census_job(job("N"), os.path.join(FIX, "named", "Pokemon - Named [Hack][3.3.1].zip"))
self.assertEqual(rec["installed_version"], "3.3.1")