Ejemplo n.º 1
0
    def setUp(self):
        TestUser.setUp(self)
        self.user = models.User(self.username, self.password, self.email)
        self.mock_token ='foobarbaz123456'

        with models.sessionmaker(self.engine) as session:
            session.add(self.user)
Ejemplo n.º 2
0
 def test_sessionmaker_with_engine(self):
     engine = mock.MagicMock()
     session = models.sessionmaker(engine=engine)
     self.assertEqual(session.bind, engine)
Ejemplo n.º 3
0
 def tearDown(self):
     with models.sessionmaker(self.engine) as session:
         user = session.query(models.User).\
             filter_by(id=1).first()
         session.delete(user)