adding the edge and vivaldi browser for installing the extension to, generate uuids when the browser not have a alias set
This commit is contained in:
+20
-4
@@ -5,7 +5,6 @@ from unittest.mock import patch
|
||||
|
||||
from browser_cli.cli import main, _project_version
|
||||
|
||||
|
||||
def _expected_version() -> str:
|
||||
pyproject = Path(__file__).resolve().parent.parent / "pyproject.toml"
|
||||
for line in pyproject.read_text(encoding="utf-8").splitlines():
|
||||
@@ -13,21 +12,38 @@ def _expected_version() -> str:
|
||||
return line.split('"')[1]
|
||||
raise AssertionError("version not found in pyproject.toml")
|
||||
|
||||
|
||||
def test_short_version_option():
|
||||
result = CliRunner().invoke(main, ["-V"])
|
||||
assert result.exit_code == 0
|
||||
assert result.output.strip() == _expected_version()
|
||||
|
||||
|
||||
def test_long_version_option():
|
||||
result = CliRunner().invoke(main, ["--version"])
|
||||
assert result.exit_code == 0
|
||||
assert result.output.strip() == _expected_version()
|
||||
|
||||
|
||||
def test_project_version_falls_back_to_installed_package_metadata():
|
||||
with patch("browser_cli.cli.Path.read_text", side_effect=OSError), patch(
|
||||
"browser_cli.cli.package_version", return_value="9.9.9"
|
||||
):
|
||||
assert _project_version() == "9.9.9"
|
||||
|
||||
def test_rename_profile_uses_command_level_browser_target():
|
||||
with patch("browser_cli.cli.send_command") as send_command:
|
||||
result = CliRunner().invoke(main, ["rename-profile", "--browser", "old-id", "work"])
|
||||
|
||||
assert result.exit_code == 0
|
||||
send_command.assert_called_once_with("clients.rename_profile", {"alias": "work"}, profile="old-id")
|
||||
|
||||
def test_rename_profile_uses_global_browser_target_when_set():
|
||||
with patch("browser_cli.cli.send_command") as send_command:
|
||||
result = CliRunner().invoke(main, ["--browser", "old-id", "rename-profile", "work"])
|
||||
|
||||
assert result.exit_code == 0
|
||||
send_command.assert_called_once_with("clients.rename_profile", {"alias": "work"}, profile=None)
|
||||
|
||||
def test_install_help_lists_supported_browsers():
|
||||
result = CliRunner().invoke(main, ["install", "--help"])
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert "[chrome|chromium|brave|edge|vivaldi]" in result.output
|
||||
|
||||
Reference in New Issue
Block a user