mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
add test for nondefault image names, fixes #38
This commit is contained in:
parent
39f8681e29
commit
c089561f48
3 changed files with 8 additions and 2 deletions
|
|
@ -8,14 +8,14 @@ from django.core.files.base import ContentFile
|
|||
from django.core.files.storage import get_storage_class
|
||||
from django.db import models
|
||||
from django.db.models import signals
|
||||
from django.utils.encoding import force_str
|
||||
from django.utils.encoding import force_bytes, force_str
|
||||
from django.utils.module_loading import import_string
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from PIL import Image, ImageOps
|
||||
|
||||
from avatar.conf import settings
|
||||
from avatar.utils import force_bytes, get_username, invalidate_cache
|
||||
from avatar.utils import get_username, invalidate_cache
|
||||
|
||||
avatar_storage = get_storage_class(settings.AVATAR_STORAGE)()
|
||||
|
||||
|
|
|
|||
BIN
tests/data/django #3.png
Normal file
BIN
tests/data/django #3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
|
|
@ -312,6 +312,12 @@ class AvatarTests(TestCase):
|
|||
|
||||
self.assertLess(root_mean_square_difference(image_with_exif, image_no_exif), 1)
|
||||
|
||||
def test_automatic_thumbnail_creation_nondefault_filename(self):
|
||||
upload_helper(self, "django #3.png")
|
||||
self.assertMediaFileExists(
|
||||
f"/avatars/{self.user.id}/resized/80/80/django_3.png"
|
||||
)
|
||||
|
||||
def test_has_avatar_False_if_no_avatar(self):
|
||||
self.assertFalse(avatar_tags.has_avatar(self.user))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue