Пример #1
0
def test_demisto_not_in_readme(repo):
    """
        Given
            - An integration README without the word 'Demisto'.

        When
            - Running verify_demisto_in_readme_content.

        Then
            - Ensure that the validation passes.
    """

    pack = repo.create_pack('PackName')
    integration = pack.create_integration('IntName')

    readme_path = glob.glob(os.path.join(os.path.dirname(integration.yml.path), '*README.md'))[0]

    with open(readme_path, 'w') as f:
        f.write('This checks if we have the word XSOAR in the README.')

    readme_validator = ReadMeValidator(integration.readme.path)

    assert readme_validator.verify_demisto_in_readme_content()
Пример #2
0
def test_demisto_in_repo_readme(mocker, repo):
    """
        Given
            - A repo README contains the word 'Demisto'.

        When
            - Running verify_demisto_in_readme_content.

        Then
            - Ensure that the validation not fails.
    """
    from pathlib import Path

    readme_path = Path(repo.path) / 'README.md'
    mocker.patch.object(ReadMeValidator, '__init__', return_value=None)

    with open(readme_path, 'w') as f:
        f.write('This checks if we have the word Demisto in the README.')

    with ChangeCWD(repo.path):
        readme_validator = ReadMeValidator()
        init_readmeValidator(readme_validator, repo, readme_path)
        assert readme_validator.verify_demisto_in_readme_content()