Example #1
0
def test_create_multiple_thumbnails(tmpdir_factory):
    path = tmpdir_factory.mktemp("data")
    create_multiple_thumbnails(TEST_FILE, path)
    path = str(path)
    assert len(os.listdir(path)) == 3
    assert os.path.isfile(os.path.join(path, "akina_50x50.jpg"))
    assert os.path.isfile(os.path.join(path, "akina_80x80.jpg"))
    assert os.path.isfile(os.path.join(path, "akina_100x100.jpg"))
Example #2
0
def test_create_multiple_thumbails_fails(tmpdir):
    with pytest.raises(FileNotFoundError):
        create_multiple_thumbnails('foo')
Example #3
0
def test_create_multiple_thumbnails():
    tmp = tempfile.mkdtemp()
    assert create_multiple_thumbnails(FILENAME, output_dir=tmp)
Example #4
0
def test_create_multiple_thumbnails_failure(tmpdir_factory):
    path = tmpdir_factory.mktemp("data")
    with pytest.raises(FileNotFoundError) as ex:
        create_multiple_thumbnails("foo", path)
    assert "foo does not exists" in str(ex.value)