| Index: tests/utils.py | 
| diff --git a/tests/utils.py b/tests/utils.py | 
| index 2d972259e02c9c6cf6c178eea263ea2a94ce9adf..1683c2d02c3ae68194bb02c5e3421679d94b31b5 100644 | 
| --- a/tests/utils.py | 
| +++ b/tests/utils.py | 
| @@ -18,6 +18,9 @@ import os | 
| import signal | 
| import subprocess | 
| import time | 
| +import zipfile | 
| +from io import BytesIO | 
| +import pytest | 
|  | 
|  | 
| def get_dir_contents(path): | 
| @@ -47,3 +50,36 @@ def run_test_server(site_path): | 
| time.sleep(0.5) | 
| yield 'http://localhost:5000/' | 
| os.killpg(os.getpgid(p.pid), signal.SIGTERM) | 
| + | 
| + | 
| +def create_in_memory_zip(file_names, file_data): | 
| +    """Create a BytesIO object with the contents of a zip file. | 
| + | 
| +    Parameters | 
| +    ---------- | 
| +    file_names: iterable | 
| +        Of file names. Should be the full paths of the file inside the zip. | 
| +    file_data: iterable | 
| +        The data to be contained of the files. | 
| + | 
| +    Returns | 
| +    ------- | 
| +    BytesIO | 
| +        The resulting in-memory zip file. | 
| + | 
| +    """ | 
| +    memory_zip = BytesIO() | 
| + | 
| +    with zipfile.ZipFile(memory_zip, 'w') as zf: | 
| +        for idx in range(len(file_names)): | 
| +            zf.writestr(file_names[idx], file_data[idx], zipfile.ZIP_DEFLATED) | 
| + | 
| +    memory_zip.seek(0) | 
| +    return memory_zip | 
| + | 
| + | 
| +def exception_test(func, exception, exp_msg, *args, **kw): | 
| +    with pytest.raises(exception) as err: | 
| +        func(*args, **kw) | 
| + | 
| +    assert exp_msg in str(err.value) | 
|  |