Removed skipped test

This commit is contained in:
Lorenz Padberg 2024-04-30 20:11:09 +02:00
parent 25cee52c72
commit 553fa041b7
4 changed files with 0 additions and 63 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

View File

@ -1,63 +0,0 @@
import os
from pathlib import Path
from unittest import skipIf,skip
from django.core.files import File
from django.test import RequestFactory, TestCase
from django.urls import reverse
from core.factories import UserFactory
from wagtail.images.models import Image
TEST_IMAGE = Path(__file__).parent / "test_images" / "user1_profile.jpg"
# @skipIf(
# os.environ.get("ENABLE_S3_STORAGE_UNIT_TESTS") is None,
# "Only enable tests by setting ENABLE_S3_STORAGE_UNIT_TESTS=1",
# )
@skip("This test is not working")
class UserImageViewTest(TestCase):
def setUp(self):
self.factory = RequestFactory()
self.user = UserFactory(username="supervisor")
with open(TEST_IMAGE, "rb") as f:
self.user_image, _ = Image.objects.get_or_create(
file=File(f, name=TEST_IMAGE.name),
)
def test_image(self):
self.client.force_login(self.user)
response = self._get_image(self.user_image.id, "fill-300x150")
self.assertEqual(200, response.status_code)
self.assertEqual("image/jpeg", response["Content-Type"])
def test_invalid_id(self):
image_id = 123456789
self.client.force_login(self.user)
response = self._get_image(image_id)
self.assertEqual(404, response.status_code)
def test_invalid_filter(self):
self.client.force_login(self.user)
filter_spec = "invalid-filter"
response = self._get_image(self.user_image.id, filter_spec)
self.assertEqual(response.status_code, 400)
self.assertEqual(
response.content, f"Invalid filter spec: {filter_spec}".encode()
)
def _get_image(self, image_id, filter_spec=None):
#url = reverse("wagtailimages_serve", kwargs={"image_id": image_id})
url = f"/cms/images/{image_id}"
if filter_spec:
url += f"?filter={filter_spec}"
return self.client.get(url)