Пример #1
0
 def test_on_raw_message_hello_with_uri(self):
     """A hello message with a uri should result in a new peer."""
     request = protocol.hello_request({
         'uri': 'tcp://localhost:12345'
     })
     self.tl._on_raw_message([json.dumps(request)])
     self.assertEqual(1, len(self.tl.peers))
Пример #2
0
 def test_get_profile(self):
     tl = transport.TransportLayer(1, '1.1.1.1', 12345, 1)
     self.assertEqual(
         tl.get_profile(),
         protocol.hello_request({
             'uri': 'tcp://1.1.1.1:12345'
         })
     )
Пример #3
0
 def test_get_profile(self):
     tl = transport.TransportLayer(1, '1.1.1.1', 12345, 1)
     self.assertEqual(
         tl.get_profile(),
         protocol.hello_request({'uri': 'tcp://1.1.1.1:12345'}))
Пример #4
0
 def test_on_raw_message_hello_with_uri(self):
     """A hello message with a uri should result in a new peer."""
     request = protocol.hello_request({'uri': 'tcp://localhost:12345'})
     self.tl._on_raw_message([json.dumps(request)])
     self.assertEqual(1, len(self.tl.peers))
Пример #5
0
 def test_on_raw_message_hello_no_uri(self):
     """A hello message with no uri should not add a peer."""
     self.tl._on_raw_message([json.dumps(protocol.hello_request({}))])
     self.assertEqual(0, len(self.tl.peers))
Пример #6
0
 def test_on_raw_message_hello_no_uri(self):
     """A hello message with no uri should not add a peer."""
     self.tl._on_raw_message([json.dumps(protocol.hello_request({}))])
     self.assertEqual(0, len(self.tl.peers))