diff --git a/pydis_site/apps/home/tests/test_repodata_helpers.py b/pydis_site/apps/home/tests/test_repodata_helpers.py index acf4a8175..895143570 100644 --- a/pydis_site/apps/home/tests/test_repodata_helpers.py +++ b/pydis_site/apps/home/tests/test_repodata_helpers.py @@ -5,6 +5,7 @@ from django.test import TestCase from django.utils import timezone +from httpx import HTTPStatusError from pydis_site.apps.home.models import RepositoryMetadata from pydis_site.apps.home.views import HomeView @@ -20,6 +21,15 @@ def __init__(self, json_data, status_code): def json(self): return self.json_data + def raise_for_status(self): + if not 200 >= self.status_code < 400: + raise HTTPStatusError( + # NOTE: We only consume the response status code when working with this helper. + # If we ever need the request, this shim needs to be updated. + request=None, + response=self + ) + if args[0] == HomeView.github_api: json_path = Path(__file__).resolve().parent / "mock_github_api_response.json" with open(json_path) as json_file: