fix: allow Web Store extension native messaging
- Add the Chrome Web Store extension ID alongside the keyed testing ID. - Register both extension origins in the native messaging host manifest. - Update install output so users can distinguish testing and Web Store IDs. - Add CLI coverage for the generated allowed_origins list.
This commit is contained in:
@@ -89,6 +89,34 @@ def test_install_help_lists_supported_browsers():
|
||||
assert result.exit_code == 0
|
||||
assert "[chrome|chromium|brave|edge|vivaldi]" in result.output
|
||||
|
||||
def test_install_writes_testing_and_webstore_allowed_origins(tmp_path):
|
||||
manifests = []
|
||||
|
||||
def fake_install_manifest(_browser, _host_exe, manifest):
|
||||
manifests.append(manifest)
|
||||
return [tmp_path / "com.browsercli.host.json"]
|
||||
|
||||
with patch("browser_cli.commands.install.native_host_exe", return_value=tmp_path / "browser-cli-native-host"), patch(
|
||||
"browser_cli.commands.install.write_native_host_exe"
|
||||
), patch("browser_cli.commands.install._install_manifest", side_effect=fake_install_manifest):
|
||||
result = CliRunner().invoke(main, ["install", "brave"])
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert manifests == [
|
||||
{
|
||||
"name": "com.browsercli.host",
|
||||
"description": "browser-cli native messaging host",
|
||||
"path": str(tmp_path / "browser-cli-native-host"),
|
||||
"type": "stdio",
|
||||
"allowed_origins": [
|
||||
"chrome-extension://bfpmkhngkjnfhabmfckgeohlilokodkg/",
|
||||
"chrome-extension://hekaebjhbhhdbmakimmaklbblbmccahp/",
|
||||
],
|
||||
}
|
||||
]
|
||||
assert "Testing extension ID" in result.output
|
||||
assert "Chrome Web Store extension ID" in result.output
|
||||
|
||||
def test_install_windows_registers_native_host(tmp_path):
|
||||
writes = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user