"""Ensure Android stays on the same renderer/paths and cannot enable Linux controls.""" from pathlib import Path import unittest ROOT = Path(__file__).resolve().parents[2] class SharedConsoleContract(unittest.TestCase): def test_shared_frontend_packaging(self): build=(ROOT/'android_console/build.sh').read_text() self.assertIn('stage_ui/console_core/frontend/{index.html,console.js,console.css,console.i18n.js}',build) self.assertIn('(?:health|tscreen|security|network)',build) self.assertFalse((ROOT/'android_console/frontend').exists()) def test_common_paths_and_owners(self): server=(ROOT/'android_console/src/com/iomatex/console/ConsoleService.java').read_text() debian=(ROOT/'stage_ui/console_core/backend/app.py').read_text() for endpoint in ('/api/display','/api/itscreen/status','/api/itscreen/runtime','/api/itscreen/registration','/api/itscreen/register','/api/health/summary','/api/health/services'): self.assertIn('"'+endpoint+'"',server) self.assertIn('"'+endpoint+'"',debian) ui=(ROOT/'stage_ui/console_core/frontend/console.js').read_text() self.assertIn('card.capabilities.desktop_mode !== false',ui) self.assertIn('card.capabilities.pulse_audio !== false',ui) self.assertIn('registration.capabilities.can_register === false',ui) self.assertIn('capabilities.logs === false ? "" : renderItscreenLogsCard()',ui) def test_registration_stays_client_owned(self): adapter=(ROOT/'android_console/src/com/iomatex/console/AndroidClient.java').read_text() self.assertIn('"/$devices/settings/"',adapter) self.assertIn('"action","register","host",target',adapter) self.assertNotIn('FileOutputStream',adapter) self.assertNotIn('"action","set"',adapter) self.assertNotIn('"action","clear"',adapter) self.assertIn('!local.password.equals(config.optString("password"))',adapter) self.assertIn('options.setHttpsHostnameVerificationEnabled(true)',adapter) if __name__=='__main__':unittest.main()