def test_disconnection_calls_close(): clear_expectations() db = Db(connection_context) db.connect() db.disconnect() assert not db.is_connected
def test_disconnection_sets_store_to_null(): clear_expectations() db = Db(connection_context) db.connect() db.disconnect() assert not db.store
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