Land ServerSpec cut: spine + sidecar + version + perms (#90–#93) #100
+9
-6
@@ -3305,20 +3305,23 @@ _HOME = "/Users/tester"
|
|||||||
|
|
||||||
|
|
||||||
def test_sidecar_path_verified_per_platform():
|
def test_sidecar_path_verified_per_platform():
|
||||||
|
# NOTE: assert on .as_posix() — the CI matrix includes a Windows runner where
|
||||||
|
# str(Path("/Users/…")) would render with backslashes. as_posix() normalises
|
||||||
|
# separators so these platform-parameterised checks are portable.
|
||||||
spec = c.SERVER_SPECS["ssh-mcp"]
|
spec = c.SERVER_SPECS["ssh-mcp"]
|
||||||
mac = c.sidecar_path(spec, platform="darwin", environ={}, home=_HOME)
|
mac = c.sidecar_path(spec, platform="darwin", environ={}, home=_HOME)
|
||||||
assert str(mac) == "/Users/tester/Library/Application Support/ssh-mcp/config.toml"
|
assert mac.as_posix() == "/Users/tester/Library/Application Support/ssh-mcp/config.toml"
|
||||||
# Windows resolves under %APPDATA%, not ~/.config.
|
# Windows resolves under %APPDATA%, not ~/.config.
|
||||||
win = c.sidecar_path(
|
win = c.sidecar_path(
|
||||||
spec, platform="win32", environ={"APPDATA": "C:/Users/t/AppData/Roaming"}, home=_HOME
|
spec, platform="win32", environ={"APPDATA": "C:/Users/t/AppData/Roaming"}, home=_HOME
|
||||||
)
|
)
|
||||||
assert "ssh-mcp/config.toml" in str(win)
|
assert "ssh-mcp/config.toml" in win.as_posix()
|
||||||
assert "AppData/Roaming" in str(win)
|
assert "AppData/Roaming" in win.as_posix()
|
||||||
# POSIX honours XDG_CONFIG_HOME, else ~/.config.
|
# POSIX honours XDG_CONFIG_HOME, else ~/.config.
|
||||||
xdg = c.sidecar_path(spec, platform="linux", environ={"XDG_CONFIG_HOME": "/cfg"}, home=_HOME)
|
xdg = c.sidecar_path(spec, platform="linux", environ={"XDG_CONFIG_HOME": "/cfg"}, home=_HOME)
|
||||||
assert str(xdg) == "/cfg/ssh-mcp/config.toml"
|
assert xdg.as_posix() == "/cfg/ssh-mcp/config.toml"
|
||||||
default = c.sidecar_path(spec, platform="linux", environ={}, home=_HOME)
|
default = c.sidecar_path(spec, platform="linux", environ={}, home=_HOME)
|
||||||
assert str(default) == "/Users/tester/.config/ssh-mcp/config.toml"
|
assert default.as_posix() == "/Users/tester/.config/ssh-mcp/config.toml"
|
||||||
|
|
||||||
|
|
||||||
def test_sidecar_path_none_for_non_sidecar_package():
|
def test_sidecar_path_none_for_non_sidecar_package():
|
||||||
@@ -3355,7 +3358,7 @@ def test_sidecar_args_live_when_file_absent():
|
|||||||
def test_sidecar_wrong_path_flag_on_macos():
|
def test_sidecar_wrong_path_flag_on_macos():
|
||||||
# A TOML written at the README's ~/.config path is never read on macOS.
|
# A TOML written at the README's ~/.config path is never read on macOS.
|
||||||
doc = c.sidecar_doc_path(c.SERVER_SPECS["ssh-mcp"], home=_HOME)
|
doc = c.sidecar_doc_path(c.SERVER_SPECS["ssh-mcp"], home=_HOME)
|
||||||
assert str(doc) == "/Users/tester/.config/ssh-mcp/config.toml"
|
assert doc.as_posix() == "/Users/tester/.config/ssh-mcp/config.toml"
|
||||||
st = c.sidecar_status(
|
st = c.sidecar_status(
|
||||||
_SSH, platform="darwin", environ={}, home=_HOME, exists=lambda p: p == doc
|
_SSH, platform="darwin", environ={}, home=_HOME, exists=lambda p: p == doc
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user