Пример #1
0
    def test_after_insert(self):

        with db_session(config.DB_URI) as ses:
            Base.metadata.create_all(ses.bind)
            ses.add(AfterInsertTable(initial_value=3))
            ses.commit()
            aut1 = ses.query(AfterInsertTable).all()[0]
            self.assertEquals(aut1.after_insert, 13)
Пример #2
0
 def _task_wrapper(target_id):
     """ 
     this is the first command that is run by the celery-daemon
     """
     with db_session(config.DB_URI) as s:
         p = s.query(self.TableObject).filter_by(id=target_id)[0]
         if self.run_predicate(p):
             # run the originally decorated function
             self.actual_task(p, s)
             s.add(p)
             s.commit()
Пример #3
0
    def t_est_after_update(self):
        with db_session(config.DB_URI) as ses:
            ses.add(AfterUpdateTable(update_trigger=3))
            ses.commit()
            aut1 = ses.query(AfterUpdateTable).all()[0]
            self.assertEquals(aut1.after_update, 0)
            aut1.update_trigger = 4
            ses.add(aut1)
            ses.commit()

            aut2 = ses.query(AfterUpdateTable).all()[0]
            self.assertEquals(aut2.after_update, 14)