def test_procs(): with dbkit.connect(fakedb, 'db') as ctx: dbkit.execute_proc('execute_proc') dbkit.query_proc_row('query_proc_row') dbkit.query_proc_value('query_proc_value') list(dbkit.query_proc_column('query_proc_column')) conn = ctx.mdr.conn assert conn.executed == 4 assert conn.session == [ 'cursor', 'proc:execute_proc', 'cursor-close', 'cursor', 'proc:query_proc_row', 'cursor-close', 'cursor', 'proc:query_proc_value', 'cursor-close', 'cursor', 'proc:query_proc_column', 'cursor-close']
def test_procs(self): def expected(*args): result = [] for arg in args: result += ['cursor', arg, 'commit', 'cursor-close'] return result with dbkit.connect(fakedb, 'db') as ctx: dbkit.execute_proc('execute_proc') dbkit.query_proc_row('query_proc_row') dbkit.query_proc_value('query_proc_value') list(dbkit.query_proc_column('query_proc_column')) conn = ctx.mdr.conn self.assertEqual(conn.executed, 4) self.assertEqual(conn.session, expected('proc:execute_proc', 'proc:query_proc_row', 'proc:query_proc_value', 'proc:query_proc_column'))