Exemplo n.º 1
0
 def setup(self):
     try:
         new_attrs = {}
         new_attrs.update(self.attrs)
         new_attrs.update(self.do_get_dependencies())
         self.obj = self.klass(**new_attrs)
         DBSession.add(self.obj)
         DBSession.flush()
         return self.obj
     except:
         DBSession.rollback()
         raise
Exemplo n.º 2
0
 def get_player_names(self):
     result = DBSession.query(model.PlayerRecord.player_name)\
         .filter(model.PlayerRecord.points>=1000)\
         .group_by(model.PlayerRecord.ogameid).all()
     return dict(names=[n[0] for n in result])
Exemplo n.º 3
0
 def by_user_name(cls, username):
     """Return the user object whose user name is ``username``."""
     return DBSession.query(cls).filter(cls.user_name==username).first()
Exemplo n.º 4
0
 def by_email_address(cls, email):
     """Return the user object whose email address is ``email``."""
     return DBSession.query(cls).filter(cls.email_address==email).first()
Exemplo n.º 5
0
 def test_query_obj(self):
     obj = DBSession.query(self.klass).one()
     for key, value in self.attrs.iteritems():
         assert_equals(getattr(obj, key), value)
Exemplo n.º 6
0
 def tearDown(self):
     DBSession.rollback()