Exemple #1
0
def test_registration_fails_if_user_exists():
    user = auth.User(username='******', email='*****@*****.**')
    user.create()
    reg_form = authforms.register_form()
    assert not reg_form.validates(
        web.storify({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'confirm': 'abc123',
        }))
    assert not reg_form.validates(
        web.storify({
            'username': '******',
            'email': '*****@*****.**',  # still the same e-mail
            'password': '******',
            'confirm': 'abc123',
        }))
    assert not reg_form.validates(
        web.storify({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'confirm': 'abc123',
        }))
Exemple #2
0
def test_registration_pw_confirmation():
    reg_form = authforms.register_form()
    assert reg_form.validates(web.storify({
        'username': '******',
        'email': '*****@*****.**',
        'password': '******',
        'confirm': 'abc123'
    })), reg_form.note
    assert not reg_form.validates(web.storify({
        'username': '******',
        'email': '*****@*****.**',
        'password': '******',
        'confirm': 'wont repeat'
    }))
Exemple #3
0
def test_registration_pw_confirmation():
    reg_form = authforms.register_form()
    assert reg_form.validates(
        web.storify({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'confirm': 'abc123'
        })), reg_form.note
    assert not reg_form.validates(
        web.storify({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'confirm': 'wont repeat'
        }))
Exemple #4
0
def test_registration_fails_if_user_exists():
    user = auth.User(username='******', email='*****@*****.**')
    user.create()
    reg_form = authforms.register_form()
    assert not reg_form.validates(web.storify({
        'username': '******',
        'email': '*****@*****.**',
        'password': '******',
        'confirm': 'abc123',
    }))
    assert not reg_form.validates(web.storify({
        'username': '******',
        'email': '*****@*****.**', # still the same e-mail
        'password': '******',
        'confirm': 'abc123',
    }))
    assert not reg_form.validates(web.storify({
        'username': '******',
        'email': '*****@*****.**',
        'password': '******',
        'confirm': 'abc123',
    }))
Exemple #5
0
def check_reg_invalid_emails(email):
    reg_form = authforms.register_form()
    assert not reg_form.email.validate(email)
Exemple #6
0
def test_registration_email_validation():
    reg_form = authforms.register_form()
    reg_from = authforms.register_form()
    assert reg_form.email.validate('*****@*****.**')
    for e in invalid_emails:
        yield check_reg_invalid_emails, e
Exemple #7
0
def test_registration_form():
    reg_form = authforms.register_form()
    assert isinstance(reg_form, web.form.Form)
Exemple #8
0
def check_reg_invalid_emails(email):
    reg_form = authforms.register_form()
    assert not reg_form.email.validate(email)
Exemple #9
0
def test_registration_email_validation():
    reg_form = authforms.register_form()
    reg_from = authforms.register_form()
    assert reg_form.email.validate('*****@*****.**')
    for e in invalid_emails:
        yield check_reg_invalid_emails, e
Exemple #10
0
def test_registration_form():
    reg_form = authforms.register_form()
    assert isinstance(reg_form, web.form.Form)