Files
WoW-Hybrid-gateway/tests/windows_bootstrap_relaunch_test.py
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

22 lines
1.5 KiB
Python

import sys,types,unittest
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
from windows_native_bootstrap import require_previous_closed
class Relaunch(unittest.TestCase):
def setup(self,wait):
self.closed=[];self.api=types.SimpleNamespace(k=types.SimpleNamespace(OpenProcess=lambda *a:7,WaitForSingleObject=lambda *a:wait,CloseHandle=self.closed.append))
self.paths={k:Path('/owned')/k for k in ('client','bridge','backend','codec')};self.profile={k:{'sha256':k}for k in self.paths}
self.meta={'windows_native_bootstrap':True,'pid':8,'starttime':9,'image_path':str(self.paths['client']),'dll_sha256':'bridge','wire_unix_library':{}}
for key,name in [('core','backend'),('wire_unix','backend'),('source_codec','codec')]:self.meta['wire_unix_library'].update({key+'_path':str(self.paths[name]),key+'_sha256':name})
def test_closed_owned_reusable(self):
self.setup(0);require_previous_closed(self.meta,self.profile,self.paths,self.api);self.assertEqual(self.closed,[7])
def test_live_client_preserved(self):
self.setup(258)
with self.assertRaisesRegex(ValueError,'Close the preserved'):require_previous_closed(self.meta,self.profile,self.paths,self.api)
self.assertEqual(self.closed,[7])
def test_unowned_or_changed_pin_rejected(self):
self.setup(0);self.meta['wire_unix_library']['source_codec_sha256']='changed'
with self.assertRaisesRegex(ValueError,'pins differ'):require_previous_closed(self.meta,self.profile,self.paths,self.api)
self.assertEqual(self.closed,[])
if __name__=='__main__':unittest.main()