camp/photologue/tests/helpers.py

26 lines
785 B
Python
Raw Normal View History

2025-03-24 11:35:33 +00:00
import warnings
from django.test import TestCase
from .factories import PhotoFactory, PhotoSizeFactory
class PhotologueBaseTest(TestCase):
def setUp(self):
self.s = PhotoSizeFactory(name='testPhotoSize',
width=100,
height=100)
try:
# Squash lots of ResourceWarning generated by the Pillow library during unit tests.
warnings.simplefilter("ignore", ResourceWarning)
except NameError:
# Doesn't exist in Python 2.7.
pass
self.pl = PhotoFactory(title='Landscape',
slug='landscape')
def tearDown(self):
# Need to manually remove the files created during testing.
self.pl.delete()