Skip to content

The agent that grows with you

test: cover both multiplex URL policy orderings

atakan gd98ea211f91e
diff --git a/tests/tools/test_browser_ssrf_local.py b/tests/tools/test_browser_ssrf_local.py
index 728c594b268..8ed0b6eeffa 100644
--- a/tests/tools/test_browser_ssrf_local.py
+++ b/tests/tools/test_browser_ssrf_local.py
@@ -369,8 +369,13 @@ class TestAllowPrivateUrlsConfig:
assert browser_tool._allow_private_urls() is False
+ @pytest.mark.parametrize(
+ "profile_order",
+ [("allowed", "blocked"), ("blocked", "allowed")],
+ ids=["allowed-then-blocked", "blocked-then-allowed"],
+ )
def test_profile_scoped_config_does_not_reuse_another_profiles_opt_out(
- self, tmp_path
+ self, tmp_path, profile_order
):
"""The browser's independent guard must follow the active profile."""
from hermes_constants import (
@@ -396,5 +401,7 @@ class TestAllowPrivateUrlsConfig:
finally:
reset_hermes_home_override(token)
- assert under_profile(allowed_home) is True
- assert under_profile(blocked_home) is False
+ homes = {"allowed": allowed_home, "blocked": blocked_home}
+ expected = {"allowed": True, "blocked": False}
+ for profile in profile_order:
+ assert under_profile(homes[profile]) is expected[profile]
diff --git a/tests/tools/test_url_safety.py b/tests/tools/test_url_safety.py
index 1eb4da14a9b..56bfe9b34c7 100644
--- a/tests/tools/test_url_safety.py
+++ b/tests/tools/test_url_safety.py
@@ -590,8 +590,13 @@ class TestGlobalAllowPrivateUrls:
monkeypatch.setenv("HERMES_ALLOW_PRIVATE_URLS", "false")
assert _global_allow_private_urls() is True
+ @pytest.mark.parametrize(
+ "profile_order",
+ [("allowed", "blocked"), ("blocked", "allowed")],
+ ids=["allowed-then-blocked", "blocked-then-allowed"],
+ )
def test_profile_scoped_config_does_not_reuse_another_profiles_opt_out(
- self, tmp_path, monkeypatch
+ self, tmp_path, monkeypatch, profile_order
):
"""Multiplexed profiles must resolve their own private-URL policy."""
from hermes_constants import (
@@ -623,8 +628,10 @@ class TestGlobalAllowPrivateUrls:
finally:
reset_hermes_home_override(token)
- assert under_profile(allowed_home) is True
- assert under_profile(blocked_home) is False
+ homes = {"allowed": allowed_home, "blocked": blocked_home}
+ expected = {"allowed": True, "blocked": False}
+ for profile in profile_order:
+ assert under_profile(homes[profile]) is expected[profile]
class TestAllowPrivateUrlsIntegration: