def test_save_method_saves_binary_file(dietstorage):
    (path, copypath, tmppath, content) = prepare_test_files('stockholm.jpg')
    new_path = dietstorage.save(path, open(copypath, 'rb'))
    try:
        assert exists(new_path)
        assert (open(new_path, 'rb').read() == content)
        assert (not exists(tmppath))
    finally:
        os.remove(new_path)
        os.remove(copypath)
def test_save_method_saves_binary_file(dietstorage):
    (path, copypath, tmppath, content) = prepare_test_files('stockholm.jpg')
    new_path = dietstorage.save(path, open(copypath, 'rb'))
    try:
        assert exists(new_path)
        assert (open(new_path, 'rb').read() == content)
        assert (not exists(tmppath))
    finally:
        os.remove(new_path)
        os.remove(copypath)