aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2024-04-01 20:40:13 +0200
committerGravatar Johannes Christ <[email protected]>2024-04-01 20:40:13 +0200
commit3a4c2e311c39506a09b3b56411145c819f97f9a5 (patch)
treef85b6ab25b54c861594ac2eab7f635083f320190
parentMerge pull request #1286 from python-discord/jb3/filterlist-perf-improvements (diff)
Return BytesIO as fp for mocked HTTP errors
Prevent spurious test failures on Solaris systems.
-rw-r--r--pydis_site/apps/api/tests/test_github_webhook_filter.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/pydis_site/apps/api/tests/test_github_webhook_filter.py b/pydis_site/apps/api/tests/test_github_webhook_filter.py
index 649a9e64..d64e1a13 100644
--- a/pydis_site/apps/api/tests/test_github_webhook_filter.py
+++ b/pydis_site/apps/api/tests/test_github_webhook_filter.py
@@ -1,3 +1,4 @@
+import io
from unittest import mock
from urllib.error import HTTPError
@@ -58,6 +59,7 @@ class GitHubWebhookFilterAPITests(APITestCase):
mock.patch.object(GitHubWebhookFilterView, "logger") as logger,
):
urlopen.side_effect = HTTPError(None, 429, 'Too Many Requests', {}, None)
+ urlopen.side_effect.fp = io.BytesIO()
logger.warning = mock.PropertyMock()
self.client.post(url, data=payload, headers=headers)
@@ -72,6 +74,7 @@ class GitHubWebhookFilterAPITests(APITestCase):
mock.patch.object(GitHubWebhookFilterView, "logger") as logger,
):
urlopen.side_effect = HTTPError(None, 451, 'Unavailable For Legal Reasons', {}, None)
+ urlopen.side_effect.fp = io.BytesIO()
logger.warning = mock.PropertyMock()
self.client.post(url, data=payload, headers=headers)