make it easyer to connect to a remove browser allow it with --browser ip alias too
Testing / test (push) Failing after 13m59s
Testing / test (push) Failing after 13m59s
This commit is contained in:
+24
-3
@@ -135,7 +135,9 @@ def test_install_windows_registers_native_host(tmp_path, monkeypatch):
|
||||
assert any("@echo off" in text for text in wrapper_writes)
|
||||
|
||||
def test_clients_exits_cleanly_when_registry_is_missing():
|
||||
with patch("browser_cli.cli.REGISTRY_PATH", Path("/nonexistent/browser-cli-registry.json")):
|
||||
with patch("browser_cli.cli.REGISTRY_PATH", Path("/nonexistent/browser-cli-registry.json")), patch(
|
||||
"browser_cli.cli.active_browser_targets", return_value=[]
|
||||
):
|
||||
result = CliRunner().invoke(main, ["clients"])
|
||||
|
||||
assert result.exit_code == 1
|
||||
@@ -153,7 +155,7 @@ def test_clients_reads_registry_with_trailing_garbage(tmp_path):
|
||||
|
||||
with patch("browser_cli.cli.REGISTRY_PATH", registry_path), patch(
|
||||
"browser_cli.cli.send_command", side_effect=fake_send_command
|
||||
):
|
||||
), patch("browser_cli.cli.active_browser_targets", return_value=[]):
|
||||
result = CliRunner().invoke(main, ["clients"])
|
||||
|
||||
assert result.exit_code == 0
|
||||
@@ -208,7 +210,7 @@ def test_clients_shows_named_profile_and_uses_socket_uuid_for_default(tmp_path):
|
||||
|
||||
with patch("browser_cli.cli.REGISTRY_PATH", registry_path), patch(
|
||||
"browser_cli.cli.send_command", side_effect=fake_send_command
|
||||
):
|
||||
), patch("browser_cli.cli.active_browser_targets", return_value=[]):
|
||||
result = CliRunner().invoke(main, ["clients"])
|
||||
|
||||
assert result.exit_code == 0
|
||||
@@ -238,6 +240,25 @@ def test_tabs_list_multi_browser_shows_browser_column():
|
||||
assert "work" in result.output
|
||||
|
||||
|
||||
def test_tabs_list_with_remote_uses_only_remote_targets():
|
||||
with patch(
|
||||
"browser_cli.commands.tabs.active_browser_targets",
|
||||
side_effect=AssertionError("local targets should not be used for explicit remote"),
|
||||
), patch(
|
||||
"browser_cli.commands.tabs.remote_browser_targets",
|
||||
return_value=[BrowserTarget("work", "remote-host:work", "", remote="remote-host:8765", token="secret")],
|
||||
), patch(
|
||||
"browser_cli.commands.tabs.send_command",
|
||||
return_value=[{"id": 1, "windowId": 1, "active": True, "title": "Remote", "url": "https://example.com"}],
|
||||
) as send_command, patch("browser_cli.cli.save_remote_token"):
|
||||
result = CliRunner().invoke(main, ["--remote", "remote-host:8765", "--token", "secret", "tabs", "list"])
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert "remote-host:work" in result.output
|
||||
assert "Remote" in result.output
|
||||
send_command.assert_called_once_with("tabs.list", {}, profile="work", remote="remote-host:8765", token="secret")
|
||||
|
||||
|
||||
def test_tabs_list_with_explicit_browser_does_not_show_browser_column():
|
||||
with patch(
|
||||
"browser_cli.commands.tabs.active_browser_targets",
|
||||
|
||||
Reference in New Issue
Block a user