tests: empty media fields before test_asset_template_tags (#24453)

This commit is contained in:
Frédéric Péters 2018-06-20 14:22:38 +02:00
parent d84205e181
commit 5c74aa4de3
1 changed files with 6 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import shutil
from StringIO import StringIO
import pytest
@ -130,6 +131,11 @@ def test_get_group():
assert t.render(context) == 'New York,Chicago,'
def test_asset_template_tags():
for path in ('uploads', 'assets'):
if os.path.exists(default_storage.path(path)):
shutil.rmtree(default_storage.path(path))
assert Asset.objects.count() == 0
with override_settings(COMBO_ASSET_SLOTS={'collectivity:banner': {'label': 'Banner'}}):
t = Template('''{% load assets %}{% get_asset "collectivity:banner" as banner %}{% if banner %}BANNER{% endif %}''')
assert t.render(Context()) == ''