コード例 #1
0
ファイル: test_forms.py プロジェクト: bwinton/user-advocacy
    def test_validate_user_already_registered(self, user):
        # Enters username that is already registered
        form = RegisterForm(username=user.username, email='*****@*****.**',
            password='******', confirm='example')

        assert form.validate() is False
        assert 'Username already registered' in form.username.errors
コード例 #2
0
ファイル: test_forms.py プロジェクト: bwinton/user-advocacy
    def test_validate_email_already_registered(self, user):
        # enters email that is already registered
        form = RegisterForm(username='******', email=user.email,
            password='******', confirm='example')

        assert form.validate() is False
        assert 'Email already registered' in form.email.errors
コード例 #3
0
    def test_validate_user_already_registered(self, user):
        # Enters username that is already registered
        form = RegisterForm(username=user.username,
                            email='*****@*****.**',
                            password='******',
                            confirm='example')

        assert form.validate() is False
        assert 'Username already registered' in form.username.errors
コード例 #4
0
    def test_validate_email_already_registered(self, user):
        # enters email that is already registered
        form = RegisterForm(username='******',
                            email=user.email,
                            password='******',
                            confirm='example')

        assert form.validate() is False
        assert 'Email already registered' in form.email.errors
def register():
    form = RegisterForm(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        new_user = User.create(username=form.username.data,
                               email=form.email.data,
                               password=form.password.data,
                               active=True)
        flash("Thank you for registering. You can now log in.", 'success')
        return redirect(url_for('public.home'))
    else:
        flash_errors(form)
    return render_template('public/register.html', form=form)
コード例 #6
0
ファイル: views.py プロジェクト: bwinton/user-advocacy
def register():
    form = RegisterForm(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        new_user = User.create(username=form.username.data,
                        email=form.email.data,
                        password=form.password.data,
                        active=True)
        flash("Thank you for registering. You can now log in.", 'success')
        return redirect(url_for('public.home'))
    else:
        flash_errors(form)
    return render_template('public/register.html', form=form)
コード例 #7
0
 def test_validate_success(self, db):
     form = RegisterForm(username='******',
                         email='*****@*****.**',
                         password='******',
                         confirm='example')
     assert form.validate() is True
コード例 #8
0
ファイル: test_forms.py プロジェクト: bwinton/user-advocacy
 def test_validate_success(self, db):
     form = RegisterForm(username='******', email='*****@*****.**',
         password='******', confirm='example')
     assert form.validate() is True