示例#1
0
def remove_session(exc):
    if exc and not is_fake_error(exc):
        app.logger.exception("Rolling back database")
        Session.rollback()
    else:
        Session.commit()
    Session.remove()
示例#2
0
    def test_events_persist(self):
        e = event.Event.for_name("Drink glass of water")
        o = e.track(attrs=dict(size="16", location="office"))
        when = o.when
        attrs = dict(o.attrs)

        # Reload from db
        Session.commit()
        Session.remove()

        e = event.Event.for_name("Drink glass of water")
        o1 = e.entries()[0]
        self.assertDatetimesEqual(when, o1.when)
        self.assertEqual(attrs, o1.attrs)
示例#3
0
 def tearDown(self):
     Session.remove()