| 45 | yield conn |
| 46 | |
| 47 | def test_commits(self, local_connection): |
| 48 | users = self.tables.users |
| 49 | connection = local_connection |
| 50 | transaction = connection.begin() |
| 51 | connection.execute(users.insert(), dict(user_id=1, user_name="user1")) |
| 52 | transaction.commit() |
| 53 | |
| 54 | transaction = connection.begin() |
| 55 | connection.execute(users.insert(), dict(user_id=2, user_name="user2")) |
| 56 | connection.execute(users.insert(), dict(user_id=3, user_name="user3")) |
| 57 | transaction.commit() |
| 58 | |
| 59 | transaction = connection.begin() |
| 60 | result = connection.exec_driver_sql("select * from users") |
| 61 | assert len(result.fetchall()) == 3 |
| 62 | transaction.commit() |
| 63 | connection.close() |
| 64 | |
| 65 | def test_rollback(self, local_connection): |
| 66 | """test a basic rollback""" |