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_send_by_least_busy_route(self): """Test send by least busy route""" ucsb = Node('ucsb') self.ucla.add_link(Link(ucsb, 1)) ucsb.add_link(Link(self.sri, 1)) self.ucla.links['sri'].weight = 10 message = Message('utah', 1) message.send(self.ucla) assert message.route_nodes == [self.utah, self.sri, ucsb, self.ucla]
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