From 0e698e58b959664287f3510f240c939951bfa84d Mon Sep 17 00:00:00 2001 From: Glandos Date: Mon, 19 Feb 2018 22:26:56 +0100 Subject: [PATCH] test no compression cases --- tests/test_compress_assets_plugin.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_compress_assets_plugin.py b/tests/test_compress_assets_plugin.py index fef979f..fe55ff4 100644 --- a/tests/test_compress_assets_plugin.py +++ b/tests/test_compress_assets_plugin.py @@ -88,3 +88,17 @@ def test_compress(disconnect_signals, settings, tmpdir, method, assert not path_exists assert path_exists if file_ext in suffixes else not path_exists + +@pytest.mark.parametrize("method,compress_suffix,mask", + [('zopfli', 'gz', 'zopfli.gzip'), + ('brotli', 'br', 'brotli'), + ('__does_not_exist__', 'br', None)]) +def test_failed_compress(mask_modules, disconnect_signals, settings, tmpdir, + method, compress_suffix, mask): + mask_modules.mask(mask) + make_gallery(settings, tmpdir, method) + + for path, dirs, files in os.walk(settings['destination']): + for file in files: + path_exists = os.path.exists('{}.{}'.format(os.path.join(path, file), compress_suffix)) + assert not path_exists