Commit cf8ec8c1 authored by Vincent Pelletier's avatar Vincent Pelletier

Allow detecting pending connections at node level.

parent 59abb90d
......@@ -115,11 +115,12 @@ class Node(object):
assert self._connection is not None
return self._connection
def isConnected(self):
def isConnected(self, connecting=False):
"""
Returns True is a connection is established with the node
"""
return self._connection is not None
return self._connection is not None and (connecting or
not self._connection.connecting)
def isIdentified(self):
"""
......
......@@ -263,7 +263,7 @@ class NeoUnitTestBase(NeoTestBase):
is_server=False, connector=None, peer_id=None):
if connector is None:
connector = self.getFakeConnector()
return Mock({
conn = Mock({
'getUUID': uuid,
'getAddress': address,
'isServer': is_server,
......@@ -272,6 +272,8 @@ class NeoUnitTestBase(NeoTestBase):
'getConnector': connector,
'getPeerId': peer_id,
})
conn.connecting = False
return conn
def checkProtocolErrorRaised(self, method, *args, **kwargs):
""" Check if the ProtocolError exception was raised """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment