Final review fixes for System S3 (Appearance): - I1: the on-demand metadata deviation is D124 (TESTING.md, inspector markers); TESTING.md names the spec that pins it, since no concept comparison renders that state. - I2: System checks the display defaults for conflicts on mount, not only on storage events, and a browser write refuses a draft another page overtook, so a draft is never saved over another tab's value without the conflict status first. New two-tab spec. - I3: the layout and size defaults start the Images page only; embedded galleries (a prompt history's Shared gallery and dialogs) keep Grid/Comfortable. - M1: host rows whose /settings read failed say "Server settings could not be read." - M2: a rejected timeout shows the "Some changes were not saved" status. - M3: the browser loads on mount and on storage events never reject unhandled. - M4: the next accepted write stores the tab-only changes and clears the overlay. - M5: cache off never re-reads a source-changed selection, and refresh() never loads a deferred one. - M6: the System fixture refuses a config.json outside its temp root and restores it with os.replace. - M7: the inspection read counts wait on a request barrier, not frames. - M8 recorded as an open saved-views question in TESTING.md.
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
"""The System browser hooks only ever reset their own server's config.json (#249 S3)."""
|
|
|
|
import os
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
from unittest import mock
|
|
|
|
from tests.browser.workspace_system_fixture import register_system_commands
|
|
|
|
|
|
class TestWorkspaceSystemFixture(unittest.TestCase):
|
|
def setUp(self):
|
|
self.tmp = tempfile.TemporaryDirectory()
|
|
self.addCleanup(self.tmp.cleanup)
|
|
self.root = Path(self.tmp.name) / "server"
|
|
self.root.mkdir()
|
|
|
|
def test_refuses_a_config_path_outside_its_root(self):
|
|
elsewhere = Path(self.tmp.name) / "config.json"
|
|
elsewhere.write_bytes(b'{"real": true}')
|
|
for value in (str(elsewhere), None):
|
|
env = {
|
|
k: v for k, v in os.environ.items() if k != "PROMPT_MANAGER_CONFIG_PATH"
|
|
}
|
|
if value is not None:
|
|
env["PROMPT_MANAGER_CONFIG_PATH"] = value
|
|
with (
|
|
self.subTest(value=value),
|
|
mock.patch.dict(os.environ, env, clear=True),
|
|
):
|
|
with self.assertRaisesRegex(RuntimeError, "PROMPT_MANAGER_CONFIG_PATH"):
|
|
register_system_commands(None, None, None, self.root)
|
|
self.assertEqual(elsewhere.read_bytes(), b'{"real": true}')
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|