def test_validate_email_fails_if_account_already_confirmed(self, db):
     """validate_email fails if associated account is already confirmed."""
     user = create_dummy_user()
     user.confirmed = True
     db.session.add(user)
     db.session.commit()
     form = ResendConfirmationForm()
     form.email.data = user.email
     with pytest.raises(ValidationError):
         form.validate_email(form.email)
 def test_validate_email_fails_if_no_account_registered(self, db):
     """validate_email fails if email address not in use."""
     form = ResendConfirmationForm()
     form.email.data = '*****@*****.**'
     with pytest.raises(ValidationError):
         form.validate_email(form.email)