def test_validate_success(self, db): """Register with success.""" form = RegisterForm(username='******', email='*****@*****.**', password='******', confirm='example') assert form.validate() is True
def test_validate_email_already_registered(self, user): """Enter 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 test_validate_user_already_registered(self, user): """Enter 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
def test_validate_email_already_registered(self, user): """Enter 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 test_validate_user_already_registered(self, user): """Enter username that is already registered.""" form = RegisterForm(username=user.username, email='*****@*****.**', password='******', confirm='example') assert form.validate() is False assert 'A user with this name already exists' in form.username.errors
def test_validate_success(self, db): """Register with success.""" form = RegisterForm(username='******', email='*****@*****.**', password='******', confirm='example') assert form.validate() is True