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

Method testRawConnection

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

Source from the content-addressed store, hash-verified

52 assert file_server.num_incoming == 2 # One for file_server fixture, one for the test
53
54 def testRawConnection(self, file_server):
55 client = ConnectionServer(file_server.ip, 1545)
56 assert file_server != client
57
58 # Remove all supported crypto
59 crypt_supported_bk = CryptConnection.manager.crypt_supported
60 CryptConnection.manager.crypt_supported = []
61
62 with mock.patch('Config.config.ip_local', return_value=[]): # SSL not used for local ips
63 connection = client.getConnection(file_server.ip, 1544)
64 assert len(file_server.connections) == 1
65 assert not connection.crypt
66
67 # Close connection
68 connection.close()
69 client.stop()
70 time.sleep(0.01)
71 assert len(file_server.connections) == 0
72
73 # Reset supported crypts
74 CryptConnection.manager.crypt_supported = crypt_supported_bk
75
76 def testPing(self, file_server, site):
77 client = ConnectionServer(file_server.ip, 1545)

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