Skip to content

Commit

Permalink
Ensure ultimatethumb templatetag always outputs an empty string.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephrdev committed Mar 14, 2017
1 parent bbd345c commit 08adbec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions ultimatethumb/templatetags/ultimatethumb_tags.py
Expand Up @@ -46,3 +46,4 @@ def ultimatethumb(
thumbnail_options['pngquant'] = pngquant

context[as_var] = ThumbnailSet(source, sizes, thumbnail_options).thumbnails
return ''
24 changes: 12 additions & 12 deletions ultimatethumb/tests/test_templatetags.py
Expand Up @@ -16,7 +16,7 @@ def test_no_source(self, settings):
) % 'static:notexist.file')

context = Context()
template.render(context)
assert template.render(context) == ''

assert context['img'] is None

Expand All @@ -28,7 +28,7 @@ def test_invalid_source(self, settings):
) % 'static:test.txt')

context = Context()
template.render(context)
assert template.render(context) == ''

assert context['img'] is None

Expand All @@ -40,7 +40,7 @@ def test_static_source(self, settings):
) % 'static:50x50-placeholder.png')

context = Context()
template.render(context)
assert template.render(context) == ''

assert context['img'][0].source == os.path.join(
settings.STATICFILES_DIRS[0], '50x50-placeholder.png')
Expand All @@ -54,7 +54,7 @@ def test_path_source(self, settings):
) % source.file.path)

context = Context()
template.render(context)
assert template.render(context) == ''

assert context['img'][0].source == os.path.join(
settings.MEDIA_ROOT, source.file.name)
Expand All @@ -68,7 +68,7 @@ def test_media_source(self, settings):
) % source.file.name)

context = Context()
template.render(context)
assert template.render(context) == ''

assert context['img'][0].source == os.path.join(
settings.MEDIA_ROOT, source.file.name)
Expand All @@ -82,7 +82,7 @@ def test_crop(self):
) % source.file.path)

context = Context()
template.render(context)
assert template.render(context) == ''

assert 'img' in context
assert len(context['img']) == 1
Expand All @@ -97,7 +97,7 @@ def test_quality(self):
) % source.file.path)

context = Context()
template.render(context)
assert template.render(context) == ''

assert 'img' in context
assert len(context['img']) == 1
Expand All @@ -112,7 +112,7 @@ def test_pngquant(self):
) % source.file.path)

context = Context()
template.render(context)
assert template.render(context) == ''

assert 'img' in context
assert len(context['img']) == 1
Expand All @@ -127,7 +127,7 @@ def test_oversize(self):
) % source.file.path)

context = Context()
template.render(context)
assert template.render(context) == ''

assert 'img' in context
assert len(context['img']) == 3
Expand All @@ -147,7 +147,7 @@ def test_oversize_upscale(self):
) % source.file.path)

context = Context()
template.render(context)
assert template.render(context) == ''

assert 'img' in context
assert len(context['img']) == 4
Expand All @@ -169,7 +169,7 @@ def test_retina(self):
) % source.file.path)

context = Context()
template.render(context)
assert template.render(context) == ''

assert 'img' in context
assert len(context['img']) == 2
Expand All @@ -191,7 +191,7 @@ def test_retina_disabled(self):
) % source.file.path)

context = Context()
template.render(context)
assert template.render(context) == ''

assert 'img' in context
assert len(context['img']) == 3
Expand Down

0 comments on commit 08adbec

Please sign in to comment.