Beispiel #1
0
def test_invalid_list_of_white_list_email_domains(
    client,
    email,
):
    email_domain_validators = ValidGovEmail()
    with pytest.raises(ValidationError):
        email_domain_validators(None, _gen_mock_field(email))
Beispiel #2
0
def email_address(label='Email address', gov_user=True):
    validators = [
        Length(min=5, max=255),
        DataRequired(message='Can’t be empty'),
        ValidEmail()
    ]

    if gov_user:
        validators.append(ValidGovEmail())
    return EmailField(label, validators)
def email_address(label=_l('Email address'), gov_user=True, required=True):
    if(label == "email address"):
        label = _l("email address")
    elif (label == "phone number"):
        label = _l("phone number")

    validators = [
        ValidEmail(),
    ]

    if gov_user:
        validators.append(ValidGovEmail())

    if required:
        validators.append(DataRequired(message=_l('Can’t be empty')))

    return EmailField(label, validators, render_kw={'spellcheck': 'false'})
Beispiel #4
0
def test_valid_list_of_white_list_email_domains(
    client,
    email,
):
    email_domain_validators = ValidGovEmail()
    email_domain_validators(None, _gen_mock_field(email))