def test_disconnect(): conn = ClientConnection(SERVER_DEFAULT, PORT_DEFAULT) conn._connect() conn._disconnect() assert not is_connected(conn.sock, SERVER_DEFAULT, PORT_DEFAULT) conn.sock.close()
def test_already_connected(): conn = ClientConnection(SERVER_DEFAULT, PORT_DEFAULT) conn._connect() try: conn._connect() except: # We shouldn't raise if we're already connected assert False conn.sock.close()