def test_willAddAllIncludesPathsToTheUpdater(self, mock_walk, mock_updater): mock_walk.side_effect = [ project_directory_structure(os.path.normpath("project/path")), external_includes_structure(os.path.normpath("external/includes")), external_includes_structure(os.path.normpath("external2/includes")), [], ] patient = QtcFilesInitializer(mock_updater) includes = [os.path.normpath("external/includes"), os.path.normpath("external2/includes")] patient.initialize_includes(os.path.normpath("project/path"), includes) self.assertEqual(mock_updater.add.call_count, 15) mock_updater.add.assert_has_calls( [ mock.call(os.path.normpath("project/path"), is_dir=True), mock.call(os.path.normpath("project/path/dir1"), is_dir=True), mock.call(os.path.normpath("project/path/dir2"), is_dir=True), mock.call(os.path.normpath("project/path/dir1/subdir1"), is_dir=True), mock.call(os.path.normpath("project/path/dir1/subdir2"), is_dir=True), mock.call(os.path.normpath("external/includes"), is_dir=True), mock.call(os.path.normpath("external/includes/external_dir1"), is_dir=True), mock.call(os.path.normpath("external/includes/external_dir2"), is_dir=True), mock.call(os.path.normpath("external/includes/external_dir1/external_subdir1"), is_dir=True), mock.call(os.path.normpath("external/includes/external_dir1/external_subdir2"), is_dir=True), mock.call(os.path.normpath("external2/includes"), is_dir=True), mock.call(os.path.normpath("external2/includes/external_dir1"), is_dir=True), mock.call(os.path.normpath("external2/includes/external_dir2"), is_dir=True), mock.call(os.path.normpath("external2/includes/external_dir1/external_subdir1"), is_dir=True), mock.call(os.path.normpath("external2/includes/external_dir1/external_subdir2"), is_dir=True), ], any_order=True, )
def test_willAddAllFilePathsToTheUpdater(self, mock_walk, mock_updater): mock_walk.return_value = project_directory_structure(os.path.normpath("project/path")) patient = QtcFilesInitializer(mock_updater) patient.initialize_files(os.path.normpath("project/path")) self.assertEqual(mock_updater.add.call_count, 4) mock_updater.add.assert_has_calls( [ mock.call(os.path.normpath("project/path/file1.txt")), mock.call(os.path.normpath("project/path/file2.txt")), mock.call(os.path.normpath("project/path/dir1/subfile1.txt")), mock.call(os.path.normpath("project/path/dir1/subfile2.txt")), ], any_order=True, )