def dir_hash_swap_files_test(sample_dir_path): hash1 = dir_hasher.dir_hash(sample_dir_path) (sample_dir_path / "file1").rename(sample_dir_path / "filex") (sample_dir_path / "file2").rename(sample_dir_path / "file1") (sample_dir_path / "filex").rename(sample_dir_path / "file2") hash2 = dir_hasher.dir_hash(sample_dir_path) assert hash1 == hash2
def _add_directory(self, directory): dir_path = Path(directory) hash_ = dir_hasher.dir_hash(dir_path.resolve()) type_ = EntityTypeId.Gallery self._db_inst.add_enitity(hash_, type_, dir_path.name) self._hash_to_file_path[hash_] = dir_path
def dir_hash_move_file_test(sample_dir_path): hash1 = dir_hasher.dir_hash(sample_dir_path) (sample_dir_path / "file1").rename(sample_dir_path / "dir1" / "file1") hash2 = dir_hasher.dir_hash(sample_dir_path) assert hash1 == hash2
def dir_hash_test(sample_dir_path): hash1 = dir_hasher.dir_hash(sample_dir_path) hash2 = dir_hasher.dir_hash(sample_dir_path) assert hash1 == hash2