Skip to content

Commit 70c6ad3

Browse files
committed
tests: confirm API key doesn't leak on connection error
Signed-off-by: Cole Robinson <crobinso@redhat.com>
1 parent b9eaa59 commit 70c6ad3

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/test_ro_functional.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ def test_rest_xmlrpc_detection():
7474
def test_apikey_error_scraping():
7575
# Ensure the API key does not leak into any requests exceptions
7676
fakekey = "FOOBARMYKEY"
77+
78+
with pytest.raises(Exception) as e:
79+
_open_bz("https://bugzilla.redhat.nopedontexist",
80+
force_rest=True, api_key=fakekey)
81+
assert fakekey not in str(e.value)
82+
83+
with pytest.raises(Exception) as e:
84+
_open_bz("https://bugzilla.redhat.nopedontexist",
85+
force_xmlrpc=True, api_key=fakekey)
86+
assert fakekey not in str(e.value)
87+
7788
with pytest.raises(Exception) as e:
7889
_open_bz("https://httpstat.us/502&foo",
7990
force_xmlrpc=True, api_key=fakekey)

0 commit comments

Comments
 (0)