def test_txn_rolls_back_and_raises_on_failure(fake_cursor): with pytest.raises(ValueError): with _txn(): raise ValueError('lol sup') fake_cursor.connection.rollback.assert_called_once_with() assert not fake_cursor.connection.commit.called
def test_txn_rolls_back_and_raises_on_failure(fake_cursor): with pytest.raises(ValueError): with _txn(): raise ValueError('lol sup') fake_cursor.connection.rollback.assert_called_once() assert not fake_cursor.connection.commit.called
def test_txn_commits_on_success(fake_cursor): with _txn(): pass fake_cursor.connection.commit.assert_called_once_with() assert not fake_cursor.connection.rollback.called
def test_txn_commits_on_success(fake_cursor): with _txn(): pass fake_cursor.connection.commit.assert_called_once() assert not fake_cursor.connection.rollback.called