def test_copy_if_destination_does_not_have_file(self): compare = FolderCompare('/tmp/source/path', '/tmp/destination/path') diff = compare.compute_diff() assert {'from': '/tmp/source/path/file_1.pdf', 'to': '/tmp/destination/path/file_1.pdf'} in diff['copy'] assert {'from': '/tmp/source/path/file_2.pdf', 'to': '/tmp/destination/path/file_2.pdf'} in diff['copy'] assert {'from': '/tmp/source/path/file_3.pdf', 'to': '/tmp/destination/path/file_3.pdf'} in diff['copy']
def test_copy_file_only_if_modified(self): compare = FolderCompare('/tmp/source/path', '/tmp/destination/path') diff = compare.compute_diff() assert {'from': '/tmp/source/path/existing_file.jpeg', 'to': '/tmp/destination/path/existing_file.jpeg'} in diff['copy'] assert {'from': '/tmp/source/path/folder_2/existing_file.psd', 'to': '/tmp/destination/path/folder_2/existing_file.psd'} in diff['copy'] assert {'from': '/tmp/source/path/folder_2/not_changed.txt', 'to': '/tmp/destination/path/folder_2/not_changed.txt'} not in diff['copy']
def test_delete_file_in_a_subfolder_of_source(self): compare = FolderCompare('/tmp/source/path', '/tmp/destination/path') diff = compare.compute_diff() assert '/tmp/destination/path/folder_2/not_in_src.mov' in diff['delete']
def test_delete_folder_should_not_include_delete_for_files_in_folder_marked_for_deletion(self): compare = FolderCompare('/tmp/source/path', '/tmp/destination/path') diff = compare.compute_diff() assert '/tmp/destination/path/folder_to_delete' in diff['delete_folders']
def test_delete_file_if_not_in_source(self): compare = FolderCompare('/tmp/source/path', '/tmp/destination/path') diff = compare.compute_diff() assert '/tmp/destination/path/not_in_src.pptx' in diff['delete']
def test_copy_folder_should_not_include_files_in_folder_marked_for_copy(self): compare = FolderCompare('/tmp/source/path', '/tmp/destination/path') diff = compare.compute_diff() assert {'from': '/tmp/source/path/another_folder/another_file.mp4', 'to': '/tmp/destination/path/another_folder/another_file.mp4'} not in diff['copy']
def test_copy_file_in_a_sub_folder_in_source(self): compare = FolderCompare('/tmp/source/path', '/tmp/destination/path') diff = compare.compute_diff() assert {'from': '/tmp/source/path/folder_2/file.docx', 'to': '/tmp/destination/path/folder_2/file.docx'} in diff['copy']
def test_copy_folder_if_destination_does_not_have_folder(self): compare = FolderCompare('/tmp/source/path', '/tmp/destination/path') diff = compare.compute_diff() assert {'from': '/tmp/source/path/another_folder', 'to': '/tmp/destination/path/another_folder'} in diff['copy_folders']