def query_homonym(self, lastname, email): """ collect the accounts with same name or email :param str lastname: The lastname to check :param str email: the email to check :returns: The SQLAlchemy query object :rtype: obj """ query = User.query().filter( or_( User.lastname == lastname, User.email == email, )) return query
def query_homonym(self, lastname, email): """ collect the accounts with same name or email :param str lastname: The lastname to check :param str email: the email to check :returns: The SQLAlchemy query object :rtype: obj """ query = User.query().filter( or_( User.lastname == lastname, User.email == email, ) ) return query
def test_add_user_submit_success(config, get_csrf_request_with_db): from autonomie.views.user.user import UserAddView from autonomie.models.user.user import User config.add_route('/users/{id}', '/users/{id}') appstruct = { "lastname": u"Lastname 1", "firstname": u"Firstname 1", "email": u"*****@*****.**", "civilite": u"Monsieur", } view = UserAddView(get_csrf_request_with_db()) result = view.submit_success(appstruct) item = User.query().filter_by(lastname=u"Lastname 1").first() assert result.location == u"/users/%s" % item.id