test: harden sandbox policy mapping across switch states
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1964,3 +1964,22 @@ async def test_jk_typed_into_input_is_literal():
|
|||||||
await pilot.pause()
|
await pilot.pause()
|
||||||
assert nickname.value == "jk"
|
assert nickname.value == "jk"
|
||||||
assert app.focused is nickname
|
assert app.focused is nickname
|
||||||
|
|
||||||
|
|
||||||
|
def test_policy_is_none_when_sandbox_off_regardless_of_suboptions():
|
||||||
|
"""When sandboxing is off, the (now hidden) fs/net sub-option values are
|
||||||
|
discarded — the submitted policy is None no matter what they hold."""
|
||||||
|
from hqt.tui.screens.new_session import NewSessionScreen
|
||||||
|
|
||||||
|
assert NewSessionScreen._policy_from(False, "ro", False) is None
|
||||||
|
assert NewSessionScreen._policy_from(False, "rw", True) is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_policy_reflects_suboptions_when_sandbox_on():
|
||||||
|
"""When sandboxing is on, the fs/net sub-option values flow into the policy."""
|
||||||
|
from hqt.tui.screens.new_session import NewSessionScreen
|
||||||
|
|
||||||
|
policy = NewSessionScreen._policy_from(True, "ro", False)
|
||||||
|
assert policy is not None
|
||||||
|
assert policy.fs == "ro"
|
||||||
|
assert policy.net is False
|
||||||
|
|||||||
Reference in New Issue
Block a user