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))
 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'
         })
     )
 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'}))
 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))
 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))
 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))