MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / testGetConnection

Method testGetConnection

src/Test/TestConnectionServer.py:85–99  ·  view source on GitHub ↗
(self, file_server)

Source from the content-addressed store, hash-verified

83 client.stop()
84
85 def testGetConnection(self, file_server):
86 client = ConnectionServer(file_server.ip, 1545)
87 connection = client.getConnection(file_server.ip, 1544)
88
89 # Get connection by ip/port
90 connection2 = client.getConnection(file_server.ip, 1544)
91 assert connection == connection2
92
93 # Get connection by peerid
94 assert not client.getConnection(file_server.ip, 1544, peer_id="notexists", create=False)
95 connection2 = client.getConnection(file_server.ip, 1544, peer_id=connection.handshake["peer_id"], create=False)
96 assert connection2 == connection
97
98 connection.close()
99 client.stop()
100
101 def testFloodProtection(self, file_server):
102 whitelist = file_server.whitelist # Save for reset

Callers

nothing calls this directly

Calls 4

getConnectionMethod · 0.95
stopMethod · 0.95
ConnectionServerClass · 0.90
closeMethod · 0.45

Tested by

no test coverage detected