This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
from pathlib import Path
|
||||
|
||||
from browser_cli.platform import endpoint_for_alias, install_base_dir, registry_path, runtime_dir
|
||||
|
||||
|
||||
def test_runtime_dir_defaults_to_tmp_on_unix(monkeypatch):
|
||||
monkeypatch.setattr("browser_cli.platform.is_windows", lambda: False)
|
||||
|
||||
assert runtime_dir() == Path("/tmp/.browser_cli")
|
||||
|
||||
|
||||
def test_runtime_dir_uses_localappdata_on_windows(monkeypatch, tmp_path):
|
||||
monkeypatch.setattr("browser_cli.platform.is_windows", lambda: True)
|
||||
monkeypatch.setenv("LOCALAPPDATA", str(tmp_path / "LocalAppData"))
|
||||
|
||||
assert runtime_dir() == tmp_path / "LocalAppData" / "browser-cli"
|
||||
assert registry_path() == tmp_path / "LocalAppData" / "browser-cli" / "registry.json"
|
||||
|
||||
|
||||
def test_endpoint_for_alias_uses_pipe_on_windows(monkeypatch):
|
||||
monkeypatch.setattr("browser_cli.platform.is_windows", lambda: True)
|
||||
|
||||
assert endpoint_for_alias("work/browser") == r"\\.\pipe\browser-cli-work_browser"
|
||||
|
||||
|
||||
def test_install_base_dir_uses_runtime_dir_on_windows(monkeypatch, tmp_path):
|
||||
monkeypatch.setattr("browser_cli.platform.is_windows", lambda: True)
|
||||
monkeypatch.setenv("LOCALAPPDATA", str(tmp_path / "LocalAppData"))
|
||||
|
||||
assert install_base_dir() == tmp_path / "LocalAppData" / "browser-cli"
|
||||
Reference in New Issue
Block a user