Ejemplo n.º 1
0
    def password_validation(self, fixture):
        field = PasswordField()
        
        # Case: invalid
        with expected(MinLengthConstraint):
            field.set_user_input('123')
        vassert( field.validation_error is field.get_validation_constraint_named('minlength') )
        with expected(MaxLengthConstraint):
            field.set_user_input('1'*21)
        vassert( field.validation_error is field.get_validation_constraint_named('maxlength') )

        # Case: valid
        with expected(NoException):
            field.set_user_input('my passwôrd')
        vassert( not field.validation_error )
Ejemplo n.º 2
0
 def fields(self, fields):
     """See class docstring"""
     fields.email = EmailField(required=True, label=_('Email'))
     fields.new_email = EmailField(required=True, label=_('New email'))
     fields.password = PasswordField(required=True, label=_('Password'))
     fields.stay_logged_in = BooleanField(default=False, label=_('Remember me?'))
     fields.secret = Field(required=True, label=_('Secret key'))
     fields.repeat_password = RepeatPasswordField(fields.password, required=True, label=_('Re-type password'), required_message=_('Please type your password again.'))
     fields.accept_terms = BooleanField(required=True,
                                       required_message=_('Please accept the terms of service'),
                                       default=False, label=_('I accept the terms of service'))
Ejemplo n.º 3
0
def test_password_access(fixture):
    """A PasswordField is world writable, but not readable by anyone."""

    field = PasswordField()
    field.bind('password_field', EmptyStub())
    assert not field.can_read()
    assert field.can_write()
Ejemplo n.º 4
0
    def password_access(self, fixture):
        """A PasswordField is world writable, but not readable by anyone."""

        field = PasswordField()
        field.bind('password_field', fixture)
        vassert( not field.can_read() )
        vassert( field.can_write() )
Ejemplo n.º 5
0
 def fields(self, fields):
     fields.email_address = EmailField(label='Email', required=True)
     fields.password = PasswordField(label='Password', required=True)