Fixes feed tests

This commit is contained in:
Mouse Reeve 2021-09-27 17:32:54 -07:00
parent c874a762dd
commit 6c0b1da83b
1 changed files with 5 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import pathlib
from PIL import Image from PIL import Image
from django.core.files.base import ContentFile from django.core.files.base import ContentFile
from django.http import Http404
from django.template.response import TemplateResponse from django.template.response import TemplateResponse
from django.test import TestCase from django.test import TestCase
from django.test.client import RequestFactory from django.test.client import RequestFactory
@ -81,9 +82,8 @@ class FeedViews(TestCase):
request.user = self.local_user request.user = self.local_user
with patch("bookwyrm.views.feed.is_api_request") as is_api: with patch("bookwyrm.views.feed.is_api_request") as is_api:
is_api.return_value = False is_api.return_value = False
result = view(request, "mouse", 12345) with self.assertRaises(Http404):
view(request, "mouse", 12345)
self.assertEqual(result.status_code, 404)
def test_status_page_not_found_wrong_user(self, *_): def test_status_page_not_found_wrong_user(self, *_):
"""there are so many views, this just makes sure it LOADS""" """there are so many views, this just makes sure it LOADS"""
@ -102,9 +102,8 @@ class FeedViews(TestCase):
request.user = self.local_user request.user = self.local_user
with patch("bookwyrm.views.feed.is_api_request") as is_api: with patch("bookwyrm.views.feed.is_api_request") as is_api:
is_api.return_value = False is_api.return_value = False
result = view(request, "mouse", status.id) with self.assertRaises(Http404):
view(request, "mouse", status.id)
self.assertEqual(result.status_code, 404)
def test_status_page_with_image(self, *_): def test_status_page_with_image(self, *_):
"""there are so many views, this just makes sure it LOADS""" """there are so many views, this just makes sure it LOADS"""