Fixing PlaceImage tests
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user