Пример #1
0
def register():
    form = RegisterForm()
    if form.validate_on_submit():
        account = Account(form.email.data, form.name.data, form.password.data)
        db.session.add(account)
        db.session.commit()
        flash('Account has been registered, please log in.')
        return redirect(url_for(".login"))
    return render_template('register.html', form=form)
Пример #2
0
def test_password_setter():
    account = Account("*****@*****.**", "Jane", 'cat')
    assert account.password_hash is not None
Пример #3
0
def test_empty_password():
    account = Account("*****@*****.**", "Jane", None)
    assert account.verify_password('cat') == False
Пример #4
0
def test_password_salts_are_random():
    account1 = Account("*****@*****.**", "Jane", 'cat')
    account2 = Account("*****@*****.**", "John", 'cat')
    assert account1.password_hash != account2.password_hash
Пример #5
0
def test_password_verification():
    account = Account("*****@*****.**", "Jane", 'cat')
    assert account.verify_password('cat')
    assert account.verify_password('dog') == False
Пример #6
0
def test_no_password_getter():
    account = Account("*****@*****.**", "Jane", 'cat')
    account.password