def test_add_tip(self): from datetime import datetime yield createTables() tip = InternalTip() tip.fields = {'hello': 'world'} tip.comments = {'hello': 'world'} tip.pertinence = 0 expiration_time = datetime.now() tip.expiration_time = expiration_time yield tip.save() def findtip(what): store = getStore() x = list(store.find(InternalTip, InternalTip.id == what)) return x r_tip = yield transactor.run(findtip, tip.id) self.assertEqual(r_tip[0].fields['hello'], 'world') self.assertEqual(r_tip[0].comments['hello'], 'world') print "I am here now!" threadpool.stop()
def runCreateTable(model, transactor=None, database=None): """ Runs the table creation query wrapped in a transaction. Transactions run in a separate thread. """ yield transactor.run(createTable, model, transactor, database)