Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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