Fixing PlaceImage tests

This commit is contained in:
Leonhard Strohmidel 2022-09-25 16:13:19 +02:00
parent 7a7c06882a
commit f06b6bdae9
3 changed files with 12 additions and 4 deletions

View File

@ -14,7 +14,7 @@
<div class="LP-PlaceTeaser__Meta">
<div class="LP-PlaceTeaser__Info">
<span class="LP-PlaceTeaser__Title">
<h1 class="LP-Headline LP-Headline--teaser">{{place.name|truncatechars:19}}</h1>
<h1 class="LP-Headline LP-Headline--teaser">{{place.name}}</h1>
</span>
<span class="LP-PlaceTeaser__Detail">
<p class="LP-Paragraph">{{place.location|truncatechars:25}}</p>

View File

@ -42,21 +42,25 @@ class PlaceImageTestCase(ModelTestCase):
if not os.path.isdir(settings.MEDIA_ROOT):
os.mkdir(settings.MEDIA_ROOT)
images_dir = os.path.join(
settings.MEDIA_ROOT,
settings.RELATIVE_THUMBNAIL_PATH,
)
current_dir = os.path.dirname(os.path.abspath(__file__))
if not os.path.isfile(os.path.join(settings.MEDIA_ROOT, 'im_a_image_copy.jpeg')):
shutil.copyfile(
os.path.join(current_dir, 'im_a_image.jpeg'),
os.path.join(settings.MEDIA_ROOT, 'im_a_image_copy.jpeg')
os.path.join(images_dir, 'im_a_image_copy.jpeg')
)
shutil.copyfile(
os.path.join(current_dir, 'im_a_image.jpeg'),
os.path.join(settings.MEDIA_ROOT, 'im_a_image_changed.jpeg')
os.path.join(images_dir, 'im_a_image_changed.jpeg')
)
PlaceImage.objects.create(
description='Im a description',
filename=os.path.join(settings.MEDIA_ROOT, 'im_a_image_copy.jpeg'),
filename=os.path.join(images_dir, 'im_a_image_copy.jpeg'),
place=place,
submitted_when=timezone.now(),
submitted_by=user.explorer

View File

@ -46,6 +46,10 @@ class TestIsAuthenticated(ViewTestCase):
self.assertHttpRedirect(response, '?'.join([str(reverse_lazy('login')), 'next=/']))
self.assertTrue(len(messages) > 0)
self.assertTrue(
_('Please login to proceed') in response.content.decode(),
msg='Expecting a message to tell the user to login'
)
class TestIsPlaceSubmitterMixin(TestCase):