Beispiel #1
0
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
Beispiel #2
0
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
Beispiel #3
0
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
Beispiel #4
0
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