mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-04-09 07:51:00 +00:00
Add truthy/falsy file assertion utils
This commit is contained in:
parent
d62d8a824e
commit
aae6aeb142
2 changed files with 12 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from imagekit.cachefiles import ImageCacheFile
|
||||
from nose.tools import assert_false, raises
|
||||
from nose.tools import raises
|
||||
from .imagegenerators import TestSpec
|
||||
from .utils import assert_file_is_falsy
|
||||
|
||||
|
||||
def test_no_source():
|
||||
|
|
@ -9,7 +10,7 @@ def test_no_source():
|
|||
"""
|
||||
spec = TestSpec(source=None)
|
||||
file = ImageCacheFile(spec)
|
||||
assert_false(bool(file))
|
||||
assert_file_is_falsy(file)
|
||||
|
||||
|
||||
@raises(TestSpec.MissingSource)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from django.conf import settings
|
|||
from django.core.files import File
|
||||
from django.template import Context, Template
|
||||
from imagekit.lib import Image, StringIO
|
||||
from nose.tools import assert_true, assert_false
|
||||
import pickle
|
||||
from .models import Photo
|
||||
|
||||
|
|
@ -53,3 +54,11 @@ def render_tag(ttag):
|
|||
|
||||
def get_html_attrs(ttag):
|
||||
return BeautifulSoup(render_tag(ttag)).img.attrs
|
||||
|
||||
|
||||
def assert_file_is_falsy(file):
|
||||
assert_false(bool(file), 'File is not falsy')
|
||||
|
||||
|
||||
def assert_file_is_truthy(file):
|
||||
assert_true(bool(file), 'File is not truthy')
|
||||
|
|
|
|||
Loading…
Reference in a new issue