def test_save_to_temp_copies_content_to_same_named_file_in_temp_directory():
    mixin = storage.DietMixin()
    filename = 'stockholm.jpg'
    path = join(THIS_DIR, 'test_files', 'stockholm.jpg')
    with open(path, 'rb') as f:
        content = f.read()
    tmppath = join(mixin.temp_dir, filename)
    try:
        assert (exists(tmppath) is False)
        assert (mixin.save_to_temp(path, content) == tmppath)
        assert exists(tmppath)
        assert filecmp.cmp(path, tmppath)
    finally:
        os.remove(tmppath)
def test_save_to_temp_copies_content_to_same_named_file_in_temp_directory():
    mixin = storage.DietMixin()
    filename = 'stockholm.jpg'
    path = join(THIS_DIR, 'test_files', 'stockholm.jpg')
    with open(path, 'rb') as f:
        content = f.read()
    tmppath = join(mixin.temp_dir, filename)
    try:
        assert (exists(tmppath) is False)
        assert (mixin.save_to_temp(path, content) == tmppath)
        assert exists(tmppath)
        assert filecmp.cmp(path, tmppath)
    finally:
        os.remove(tmppath)