From aa303ed0776c8deab31890830934a8b0ef833f65 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Sat, 22 Apr 2023 14:55:40 +0200 Subject: 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 --- pydis_site/apps/content/tests/test_views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pydis_site/apps/content/tests') diff --git a/pydis_site/apps/content/tests/test_views.py b/pydis_site/apps/content/tests/test_views.py index 3ef9bcc4..e4f898ef 100644 --- a/pydis_site/apps/content/tests/test_views.py +++ b/pydis_site/apps/content/tests/test_views.py @@ -1,6 +1,6 @@ import textwrap from pathlib import Path -from unittest import TestCase +from unittest import TestCase, mock import django.test import markdown @@ -223,7 +223,8 @@ class TagViewTests(django.test.TestCase): def test_invalid_tag_404(self): """Test that a tag which doesn't exist raises a 404.""" - response = self.client.get("/pages/tags/non-existent/") + with mock.patch("pydis_site.apps.content.utils.fetch_tags", autospec=True): + response = self.client.get("/pages/tags/non-existent/") self.assertEqual(404, response.status_code) def test_context_tag(self): -- cgit v1.2.3