def test_find_only_supported_files(self, valid_spelled_content_pack): """ Given - valid pack directory path. When - trying to find files from a directory. Then - Ensure the files that are found are only supported files. """ doc_review = DocReviewer(file_paths=[valid_spelled_content_pack.path]) doc_review.get_files_to_run_on( file_path=valid_spelled_content_pack.path) for file in doc_review.files: assert find_type(path=file) in doc_review.SUPPORTED_FILE_TYPES
def test_find_single_file(self, valid_spelled_content_pack): """ Given - valid integration yml file path. When - trying to find the file to do the doc-review on. Then - Ensure the file that was found exist in the directory. """ doc_review = DocReviewer( file_paths=[valid_spelled_content_pack.integrations[0].yml.path]) doc_review.get_files_to_run_on( file_path=valid_spelled_content_pack.integrations[0].yml.path) for file in doc_review.files: assert path.exists(file)
def test_find_files_from_dir(self, valid_spelled_content_pack): """ Given - valid pack directory path. When - trying to find files to do doc-reviews on. Then - Ensure the files that are found exist in the directory. """ # must set file path here it otherwise use_git=True doc_review = DocReviewer(file_paths=[valid_spelled_content_pack.path]) doc_review.get_files_to_run_on( file_path=valid_spelled_content_pack.path) for file in doc_review.files: assert path.exists(file)
def test_find_files_from_git(self, mocker, valid_spelled_content_pack): """ Given - valid pack directory path. When - trying to find files to do doc-reviews on from git. Then - Ensure the files that git reports are the same found that are meant to be doc-reviewed. """ changed_files_mock = [ valid_spelled_content_pack.integrations[0].yml.path, valid_spelled_content_pack.scripts[0].yml.path ] + [rn.path for rn in valid_spelled_content_pack.release_notes] mocker.patch.object(DocReviewer, 'gather_all_changed_files', return_value=changed_files_mock) doc_review = DocReviewer(use_git=True) doc_review.get_files_to_run_on(file_path='') assert set(doc_review.files) == set(changed_files_mock)