Untitled
unknown
plain_text
a year ago
1.1 kB
8
Indexable
import pytest
import os
from pro_filer.actions.main_actions import find_duplicate_files # NOQA
@pytest.fixture
def create_files(tmp_path):
blink = tmp_path / "blink.txt"
blink.write_text("blink")
aether = tmp_path / "aether.txt"
aether.write_text("aether")
os.mkdir(tmp_path / "tmp")
dagon_tmp = tmp_path / "tmp" / "aether.txt"
dagon_tmp.write_text("aether")
return {
"blink": blink,
"aether": aether,
"dagon_tmp": dagon_tmp,
"all_files": [str(blink), str(aether), str(dagon_tmp)],
}
def test_find_duplicate_files(create_files):
context = {
"all_files": create_files["all_files"],
}
assert find_duplicate_files(context) == [
(str(create_files["aether"]), str(create_files["dagon_tmp"])),
]
def test_find_duplicate_files_with_exception(create_files):
gleipnir_tmp = create_files["dagon_tmp"].parent / "gleipnir.txt"
create_files["all_files"].append(str(gleipnir_tmp))
context = {
"all_files": create_files["all_files"],
}
with pytest.raises(ValueError):
find_duplicate_files(context)
Editor is loading...
Leave a Comment