Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ omit =
*/apps.py
*/urls.py
pydis_site/apps/api/models/bot/metricity.py
# GitHub API functions are mocked away
pydis_site/apps/content/utils.py
pydis_site/wsgi.py
pydis_site/settings.py
pydis_site/utils/resources.py
Expand Down
5 changes: 3 additions & 2 deletions pydis_site/apps/content/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import textwrap
from pathlib import Path
from unittest import TestCase
from unittest import TestCase, mock

import django.test
import markdown
Expand Down Expand Up @@ -223,7 +223,8 @@ def test_valid_tag_returns_200(self):

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):
Expand Down
5 changes: 4 additions & 1 deletion pydis_site/apps/home/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from unittest import mock

from django.test import TestCase
from django.urls import reverse

Expand All @@ -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)