File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -90,3 +90,21 @@ def test_async_client_rejects_control_character_api_key():
9090 HyperbrowserError , match = "api_key must not contain control characters"
9191 ):
9292 AsyncHyperbrowser (api_key = "bad\n key" )
93+
94+
95+ def test_sync_client_rejects_control_character_env_api_key (monkeypatch ):
96+ monkeypatch .setenv ("HYPERBROWSER_API_KEY" , "bad\n key" )
97+
98+ with pytest .raises (
99+ HyperbrowserError , match = "api_key must not contain control characters"
100+ ):
101+ Hyperbrowser ()
102+
103+
104+ def test_async_client_rejects_control_character_env_api_key (monkeypatch ):
105+ monkeypatch .setenv ("HYPERBROWSER_API_KEY" , "bad\n key" )
106+
107+ with pytest .raises (
108+ HyperbrowserError , match = "api_key must not contain control characters"
109+ ):
110+ AsyncHyperbrowser ()
Original file line number Diff line number Diff line change @@ -23,6 +23,15 @@ def test_client_config_from_env_raises_hyperbrowser_error_for_blank_api_key(
2323 ClientConfig .from_env ()
2424
2525
26+ def test_client_config_from_env_rejects_control_character_api_key (monkeypatch ):
27+ monkeypatch .setenv ("HYPERBROWSER_API_KEY" , "bad\n key" )
28+
29+ with pytest .raises (
30+ HyperbrowserError , match = "api_key must not contain control characters"
31+ ):
32+ ClientConfig .from_env ()
33+
34+
2635def test_client_config_from_env_reads_api_key_and_base_url (monkeypatch ):
2736 monkeypatch .setenv ("HYPERBROWSER_API_KEY" , "test-key" )
2837 monkeypatch .setenv ("HYPERBROWSER_BASE_URL" , "https://example.local" )
You can’t perform that action at this time.
0 commit comments