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', }))
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' }))
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' }))
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', }))
def check_reg_invalid_emails(email): reg_form = authforms.register_form() assert not reg_form.email.validate(email)
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
def test_registration_form(): reg_form = authforms.register_form() assert isinstance(reg_form, web.form.Form)