Keep web Material styling and preserve visible installer access URLs

This commit is contained in:
2026-10-26 18:37:13 +00:00
parent 48c29fd1ff
commit 41a3be8715
13 changed files with 176 additions and 15 deletions
+27 -2
View File
@@ -150,6 +150,27 @@ class SetupNativeTests(unittest.TestCase):
mapping["cc"] = cc
return lambda name: mapping.get(name)
def test_reinstall_preserves_network_settings_and_explicit_flags_override(self):
with tempfile.TemporaryDirectory() as directory:
installer = self.installer(directory, Recorder())
prefix = installer.resolve_prefix()
prefix.mkdir()
manifest = {"server_port": 8090, "ntfy_port": 8091,
"bind_address": "127.0.0.2",
"web": {"port": 8096, "host": "127.0.0.1"}}
(prefix / setup_native.MARKER).write_text(json.dumps(manifest))
args = setup_native.arguments([])
installer.preserve_network_settings(prefix, args)
self.assertEqual((args.port, args.ntfy_port, args.web_port), (8090, 8091, 8096))
self.assertEqual((args.bind_address, args.web_host), ("127.0.0.2", "127.0.0.1"))
args = setup_native.arguments(["--web-port=8082", "--port", "8080"])
installer.preserve_network_settings(prefix, args)
self.assertEqual((args.port, args.ntfy_port, args.web_port), (8080, 8091, 8082))
(prefix / setup_native.MARKER).unlink()
args = setup_native.arguments([])
installer.preserve_network_settings(prefix, args)
self.assertEqual(args.web_port, 8082)
def test_require_tools_reports_each_missing_tool_without_installing(self):
with tempfile.TemporaryDirectory() as directory:
recorder = Recorder()
@@ -435,7 +456,7 @@ class SetupNativeTests(unittest.TestCase):
with patch.object(setup_native.shutil, "which", side_effect=self.which_all()), \
patch.object(setup_native.lan, "detect_lan", return_value="192.168.1.20"), \
patch.object(setup_native.configure, "host_timezone", return_value="Europe/London"):
installer.run(setup_native.arguments([]))
installer.run(setup_native.arguments(["--web-port", "8096"]))
before = (prefix / "secrets/publisher-token").read_text()
def refuse_resolution():
@@ -443,8 +464,12 @@ class SetupNativeTests(unittest.TestCase):
installer.resolver = refuse_resolution
recorder.calls.clear()
installer.run(setup_native.arguments([]))
with redirect_stdout(io.StringIO()) as output:
installer.run(setup_native.arguments([]))
self.assertEqual((prefix / "secrets/publisher-token").read_text(), before)
self.assertEqual(manage.load(prefix)["web"]["port"], 8096)
self.assertEqual(output.getvalue().splitlines()[-2:], [
" http://localhost:8096/", " http://192.168.1.20:8096/"])
self.assertFalse(any("token" in call for call in recorder.calls), "reinstall re-created the token")
def test_ntfy_is_built_from_the_pinned_module(self):