示例#1
0
def veritas(csv_file, **kwargs):
    validator = VeritasValidor(csv_file)

    if not validator.validate():
        validator.print_errors()
    else:
        print("CSV file validated!")
示例#2
0
def test_validate():
    filename = os.path.join(CURRENT_DIR, TEST_FILE)

    validator = VeritasValidor(filename, columns=MOCK_JAHIA2WP_COLUMNS)

    # make sure test environment exists
    if not os.path.exists("/srv/test"):
        os.mkdir("/srv/test")

    validator.validate()

    errors = validator.errors

    assert "invalid wp_site_url" in errors[0].message
    assert "invalid site_type" in errors[1].message
    assert "wp_site_url is not unique" in errors[2].message
    assert "wp_site_url is not unique" in errors[3].message
    assert "invalid langs" in errors[4].message
    assert "invalid updates_automatic" in errors[5].message
    assert "wp_site_url is not unique" in errors[6].message
    assert "invalid openshift_env" in errors[7].message
    assert "wp_site_url is not unique" in errors[8].message
示例#3
0
def _check_csv(csv_file):
    """
    Check validity of CSV file containing sites information

    Arguments keywords
    csv_file -- Path to CSV file

    Return
    Instance of VeritasValidator
    """
    validator = VeritasValidor(csv_file)

    # If errors found during validation
    if not validator.validate():
        for error in validator.errors:
            logging.error(error.message)
        raise SystemExit("Invalid CSV file!")

    return validator
示例#4
0
def veritas(csv_file, **kwargs):
    validator = VeritasValidor(csv_file)

    validator.validate()

    validator.print_errors()