def test_prepare_paths_ignore_files(tmpdir, tmpfiles, file_type): """ Test if Sync.prepare_paths() ignores given file types """ sync = Sync(DEVICE_MTP_FAKE, tmpdir, DEVICE_DESTINATION, ignore_file_types=[file_type]) sync.set_source_abs() sync.set_destination_abs() for to_sync in sync.prepare_paths(): assert not to_sync['abs_fls_map']
def test_prepare_paths(tmpdir, tmpfiles): """ Test if Sync.prepare_paths() returns an expected list of paths """ sync = Sync(DEVICE_MTP_FAKE, tmpdir, DEVICE_DESTINATION) sync.set_source_abs() sync.set_destination_abs() for to_sync in sync.prepare_paths(): for key in ('abs_src_dir', 'abs_dst_dir', 'abs_fls_map'): assert key in to_sync for src, dst in to_sync['abs_fls_map']: basename = os.path.basename(src) assert src.endswith(basename) assert dst.endswith(basename) assert tmpdir in src assert DEVICE_MTP_FAKE[1] in dst assert DEVICE_DESTINATION in dst