def test_copy_dirs_into_dir_is_ok(self): self._create_dir('dir1') self._create_dir('dir2') filter = install.CopyFilter(['dir1', 'dir2'], 'dir/') filter.apply(self._tmp_src_dir, self._tmp_dst_dir) self.assertEqual(['dir/', 'dir/dir1/', 'dir/dir2/'], sorted(list_paths(self._tmp_dst_dir)))
def test_copy_files_to_dir_is_ok(self): self._create_file('file1') self._create_file('file2') filter = install.CopyFilter(['file1', 'file2'], 'dir/') filter.apply(self._tmp_src_dir, self._tmp_dst_dir) self.assertEqual(['dir/', 'dir/file1', 'dir/file2'], sorted(list_paths(self._tmp_dst_dir)))
def test_include_files_inside_directory(self): self._create_dir('dir1') self._create_dir('dir1/dir2') self._create_file('dir1/file1') self._create_file('dir1/dir2/file2') filter = install.IncludeFilter(['dir1']) filter.apply(self._tmp_src_dir, self._tmp_dst_dir) self.assertEqual( ['dir1/', 'dir1/dir2/', 'dir1/dir2/file2', 'dir1/file1'], sorted(list_paths(self._tmp_dst_dir)))
def assert_output_directory_content(self): self.assertEqual(['dir0/', 'dir0/file1.txt', 'file0.txt'], sorted(list_paths(self._tmp_dir)))
def test_filter(self): self._create_file('file1') self._create_file('file2') filter = install.IncludeFilter(['file1']) filter.apply(self._tmp_src_dir, self._tmp_dst_dir) self.assertEqual(['file1'], sorted(list_paths(self._tmp_dst_dir)))