883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
26 lines
1.6 KiB
Python
26 lines
1.6 KiB
Python
"""Private transport must never load another installation's core."""
|
|
import sys,unittest
|
|
from pathlib import Path
|
|
from types import SimpleNamespace
|
|
from unittest.mock import patch
|
|
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
|
|
import install_native_item_batch as batch
|
|
import client_ui
|
|
class PrivateWireTest(unittest.TestCase):
|
|
def test_origin_only_and_unchanged_contract(self):
|
|
contract=dict(exports=['gw_wire_unix_dispatch'],needed=['libgateway_native.so'],soname='libgateway_wine_wire.so')
|
|
for paths,valid in (('$ORIGIN',True),('/primary/build',False),('$ORIGIN:/primary/build',False),('',False)):
|
|
dynamic='Library runpath: ['+paths+']' if paths else ''
|
|
with patch.object(batch,'native_core_contract',return_value=contract),patch.object(batch.subprocess,'run',return_value=SimpleNamespace(stdout=dynamic)):
|
|
if valid:self.assertEqual(batch.verify_wire_replacement('old','new'),contract)
|
|
else:
|
|
with self.assertRaises(ValueError):batch.verify_wire_replacement('old','new')
|
|
with patch.object(batch,'native_core_contract',side_effect=[contract,dict(contract,needed=['other.so'])]):
|
|
with self.assertRaisesRegex(ValueError,'ABI/dependencies'):batch.verify_wire_replacement('old','new')
|
|
def test_observed_paladin_world_label(self):
|
|
self.assertTrue(client_ui.is_world_screen("Uther's Tomb"))
|
|
self.assertFalse(client_ui.is_world_screen('Account Password Login'))
|
|
def test_presentation_only_refuses_bridge_replacement(self):
|
|
with self.assertRaisesRegex(ValueError,'closed-client'):batch.install('unused','unused','unused',presentation_only=True,wire_unix='unused')
|
|
if __name__=='__main__':unittest.main()
|