Beispiel #1
0
def test_returned_transaction_uses_assigned_transaction_object():
    conn = Mock()
    tree = Tree(connection=conn)
    transaction = tree.make_transaction()
    assert transaction.connection is conn
Beispiel #2
0
def test_returned_transaction_uses_connection_from_pool():
    pool, conn = Mock(), Mock()
    pool.getconn.return_value = conn
    tree = Tree(pool=pool)
    transaction = tree.make_transaction()
    assert transaction.connection is conn
Beispiel #3
0
def test_make_transaction_returns_a_transaction_object():
    conn = Mock()
    tree = Tree(connection=conn)
    transaction = tree.make_transaction()
    assert transaction.__class__ == Transaction
Beispiel #4
0
def test_returned_transaction_uses_connection_from_pool():
    pool, conn = Mock(), Mock()
    pool.getconn.return_value = conn
    tree = Tree(pool=pool)
    transaction = tree.make_transaction()
    assert transaction.connection is conn
Beispiel #5
0
def test_returned_transaction_uses_assigned_transaction_object():
    conn = Mock()
    tree = Tree(connection=conn)
    transaction = tree.make_transaction()
    assert transaction.connection is conn
Beispiel #6
0
def test_make_transaction_returns_a_transaction_object():
    conn = Mock()
    tree = Tree(connection=conn)
    transaction = tree.make_transaction()
    assert transaction.__class__ == Transaction
Beispiel #7
0
def test_make_transaction_returns_a_read_write_transaction_object():
    conn = Mock()
    tree = Tree(connection=conn)
    transaction = tree.make_transaction(write=True)
    assert transaction.__class__ == ReadWriteTransaction