def test_send_back_from_non_peer(self): """Test send back from non peer""" message = Message('ucla', 1) self.sri.add_link(Link(self.ucla, 1)) self.utah.add_link(Link(self.sri, 1)) message.send(self.utah) assert message.location().name == 'ucla', message.location
def test_send_with_two_routes(self): """Test send with two routes""" ucsb = Node('ucsb') self.ucla.add_link(Link(ucsb, 1)) ucsb.add_link(Link(self.sri, 1)) message = Message('utah', 1) message.send(self.ucla) assert message.location().name == 'utah', message.location
def test_step_message_along_route(self): """ In order to display the progress of a message on Blinkenlights etc we want to be able to move the message along the route a step (node/light) at a time updating the display as we go """ message = Message('utah', 1) message.route(self.ucla) message.step() location = message.location() assert location.name == 'sri'
def test_send_message_to_non_peer(self): """Test send message to non peer""" message = Message('utah', 1) message.send(self.ucla) assert message.location().name == 'utah', message.location
def test_send_message_to_peer(self): """Test send message to peer""" message = Message('sri', 1) message.send(self.ucla) assert message.location().name == 'sri', message.location
def test_send_message_to_origin(self): """Test a node can send a message to itself""" message = Message('ucla', 1) message.send(self.ucla) assert message.location().name == 'ucla', message.location