aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/home/tests
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2023-04-22 14:55:40 +0200
committerGravatar GitHub <[email protected]>2023-04-22 12:55:40 +0000
commitaa303ed0776c8deab31890830934a8b0ef833f65 (patch)
treeec72f991da3157a1f95dcfc005e768e485d009ab /pydis_site/apps/home/tests
parentMerge pull request #950 from python-discord/rule-crosscheck (diff)
Make unittests independent of GitHub (#948)
This fixes a problem where running the unit tests successively a lot would result in 403 ratelimit exceeded errors being thrown due to the GitHub API being called by the app. Fixes #918 Co-authored-by: wookie184 <[email protected]>
Diffstat (limited to 'pydis_site/apps/home/tests')
-rw-r--r--pydis_site/apps/home/tests/test_views.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pydis_site/apps/home/tests/test_views.py b/pydis_site/apps/home/tests/test_views.py
index b1215df4..379b984e 100644
--- a/pydis_site/apps/home/tests/test_views.py
+++ b/pydis_site/apps/home/tests/test_views.py
@@ -1,3 +1,5 @@
+from unittest import mock
+
from django.test import TestCase
from django.urls import reverse
@@ -6,5 +8,6 @@ class TestIndexReturns200(TestCase):
def test_index_returns_200(self):
"""Check that the index page returns a HTTP 200 response."""
url = reverse('home:home')
- resp = self.client.get(url)
+ with mock.patch("pydis_site.apps.home.views.HomeView._get_api_data", autospec=True):
+ resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)