Example #1
0
def test_disconnection_calls_close():
    clear_expectations()

    db = Db(connection_context)

    db.connect()
    db.disconnect()
    assert not db.is_connected
Example #2
0
def test_disconnection_sets_store_to_null():
    clear_expectations()

    db = Db(connection_context)

    db.connect()
    db.disconnect()
    assert not db.store
Example #3
0
def test_disconnecting_from_not_connected_raises():
    clear_expectations()

    db = Db(connection_context)

    try:
        db.disconnect()
    except RuntimeError, err:
        assert str(err) == "You have to connect before disconnecting"
        return