Example #1
0
def test_valid_sections(integration, file_input):
    """
    Given
        - Valid sections in different forms from SECTIONS
    When
        - Run validate on README file
    Then
        - Ensure no empty sections from the SECTIONS list
    """

    integration.readme.write(file_input)
    readme_path = integration.readme.path
    readme_validator = ReadMeValidator(readme_path)
    result = readme_validator.verify_no_empty_sections()

    assert result
Example #2
0
def test_unvalid_verify_no_empty_sections(integration, capsys, file_input,
                                          missing_section):
    """
    Given
        - Empty sections in different forms
    When
        - Run validate on README file
    Then
        - Ensure no empty sections from the SECTIONS list
    """

    integration.readme.write(file_input)
    readme_path = integration.readme.path
    readme_validator = ReadMeValidator(readme_path)
    result = readme_validator.verify_no_empty_sections()

    stdout, _ = capsys.readouterr()
    section_error = f'{missing_section} is empty, please elaborate or delete the section.'

    assert not result
    assert section_error in stdout
Example #3
0
def test_combined_unvalid_verify_no_empty_sections(integration, capsys,
                                                   file_input):
    """
    Given
        - Couple of empty sections
    When
        - Run validate on README file
    Then
        - Ensure no empty sections from the SECTIONS list
    """

    integration.readme.write(file_input)
    readme_path = integration.readme.path
    readme_validator = ReadMeValidator(readme_path)
    result = readme_validator.verify_no_empty_sections()

    stdout, _ = capsys.readouterr()
    error = 'Failed verifying README.md Error Message is: Troubleshooting is empty, please elaborate or delete the' \
            ' section.\nAdditional Information is empty, please elaborate or delete the section.'

    assert not result
    assert error in stdout