def test_update_node_without_mapping(self): mapper = MockPortMapper() manager = PortMapperManager(mappers=[mapper]) manager.update_node(self.node) assert self.node.pub_port == 50102 assert self.node.p2p_pub_port == 50103
def test_update_node(self): mapper = MockPortMapper() manager = PortMapperManager(mappers=[mapper]) manager._mapping = {'TCP': {40102: 60102, 40103: 60103, 3282: 6282}} manager.update_node(self.node) assert self.node.pub_port == 60102 assert self.node.p2p_pub_port == 60103