Skip to content

Commit 5b77b4b

Browse files
author
Kevin Allioli
committed
fix(tests): move getaddrinfo patch inside test_ssrf_allowed to avoid unused fixture warning
- Move patch decorator from function level to context manager inside test body - Remove unused `_mock` parameter that was causing pytest fixture warnings - Maintains same mocking behavior while fixing linter/test warnings
1 parent 041296d commit 5b77b4b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tests/test_webhook.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ def test_ssrf_blocked(url):
2929
assert _is_ssrf_safe(url) is False
3030

3131

32-
@patch("socket.getaddrinfo", side_effect=_fake_getaddrinfo)
3332
@pytest.mark.parametrize("url", [
3433
"https://hooks.example.com/notify",
3534
"https://discord.com/api/webhooks/123/abc",
3635
"http://1.2.3.4/hook", # public IP
3736
])
38-
def test_ssrf_allowed(url, _mock):
39-
assert _is_ssrf_safe(url) is True
37+
def test_ssrf_allowed(url):
38+
with patch("socket.getaddrinfo", side_effect=_fake_getaddrinfo):
39+
assert _is_ssrf_safe(url) is True

0 commit comments

Comments
 (0)