def test_are_modules_installed_for_verify_false_res(tmp_path): r = str(tmp_path / "README.md") with open(r, 'w') as f: f.write('Test readme') readme_validator = ReadMeValidator(r) # modules will be missing in tmp_path assert not readme_validator.are_modules_installed_for_verify(tmp_path)
def test_is_file_valid_mdx_server(mocker, current, answer): readme_validator = ReadMeValidator(current) valid = readme_validator.are_modules_installed_for_verify( readme_validator.content_path) if not valid: pytest.skip('skipping mdx server test. ' + MDX_SKIP_NPM_MESSAGE) return mocker.patch.dict(os.environ, {'DEMISTO_README_VALIDATION': 'yes'}) assert readme_validator.is_valid_file() is answer assert ReadMeValidator._MDX_SERVER_PROCESS is not None ReadMeValidator.stop_mdx_server()
def test_is_file_valid(mocker, current, answer): readme_validator = ReadMeValidator(current) valid = readme_validator.are_modules_installed_for_verify(readme_validator.content_path) if not valid: pytest.skip('skipping mdx test. ' + MDX_SKIP_NPM_MESSAGE) return with requests_mock.Mocker() as m: # Mock get requests m.get('https://github.com/demisto/content/blob/123/Packs/AutoFocus/doc_files/AutoFocusPolling.png', status_code=200, text="Test1") m.get('https://github.com/demisto/content/blob/123/Packs/FeedOffice365/doc_files/test.png', status_code=200, text="Test2") m.get('https://github.com/demisto/content/raw/123/Packs/valid/doc_files/test.png', status_code=200, text="Test3") mocker.patch.dict(os.environ, {'DEMISTO_README_VALIDATION': 'yes', 'DEMISTO_MDX_CMD_VERIFY': 'yes'}) assert readme_validator.is_valid_file() is answer assert not ReadMeValidator._MDX_SERVER_PROCESS
def test_is_file_valid(current, answer): readme_validator = ReadMeValidator(current) valid = readme_validator.are_modules_installed_for_verify() env_var = os.environ.get('DEMISTO_README_VALIDATION') if valid and env_var: assert readme_validator.is_valid_file() is answer