test(stores): cover the GOG registry import without proot

This commit is contained in:
The412Banner committed 2026-12-05 21:57:50 +00:00
1 parent 0438887e91
commit 94ae2ce846
1 file changed
+25
+25
View File
@@ -921,6 +921,31 @@ class GogRegistry(unittest.TestCase):
self.assertFalse((Path(root) / 'compat/pfx' / store.GOG_REGISTRY_MARK).exists())
self.assertEqual('no-proton', store.apply_gog_registry(folder, root + '/compat', root + '/missing'))
def test_a_native_import_names_its_file_and_the_game_by_their_guest_paths(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp) / 'linuxfs'
(root / 'tmp').mkdir(parents=True)
folder = game(root / 'root', store_id='gog', ident='7')
gog_script(folder, '7', [set_registry(root='HKLM', subkey='Software\\Game', valueName='Path',
valueData='{app}', valueType='string')])
proton = Path(tmp) / 'proton'
proton.write_text('selected Proton')
data = root / 'root/compat'
imported = []
def run(argv, **kwargs):
source = argv[4]
self.assertTrue(source.startswith('Z:\\tmp\\droiddeck-gog-'), source)
self.assertTrue(source.endswith('\\registry.reg'), source)
imported.append((root / source[3:].replace('\\', '/')).read_bytes()[2:].decode('utf-16-le'))
(data / 'pfx').mkdir(parents=True, exist_ok=True)
(data / 'pfx/system.reg').write_text('Wine registry')
return subprocess.CompletedProcess(argv, 0)
with patch.dict(os.environ, {'DDNATV_ROOT': str(root), 'DD_STORE_PROTON': str(proton)}), \
patch.object(tempfile, 'tempdir', str(root / 'tmp')), \
patch.object(store.subprocess, 'run', side_effect=run):
self.assertEqual('written=1', store.apply_gog_registry(folder, str(data), str(proton)))
self.assertIn('"Path"="Z:\\\\root\\\\Games\\\\Stores\\\\Epic\\\\Metalstorm"', imported[0])
def test_every_gog_launch_brings_the_registry_in(self):
with tempfile.TemporaryDirectory() as root:
folder = game(root, store_id='gog')