def test_matches_a_node_with_combined_messages(self): node_labels = [("%snode" % i, 'small&&ovh') for i in range(10)] offline_nodes = ["%snode" % i for i in range(12, 20)] offline_msg = ';'.join( [BecauseNodeIsOffline % i for i in offline_nodes]) node_msg = ';'.join([BecauseLabelIsMissing % i for i in node_labels]) api_message = "%s;%s;%s" % (offline_msg, node_msg, BecauseLabelIsMissing % ('centos6', 'small&&x86_64')) assert util.from_node_without_label(api_message) == 'centos6'
def test_matches_a_node(self): msg = BecauseLabelIsMissing % ('centos6', 'x86_64&&small') assert util.from_node_without_label(msg) == 'centos6'
def test_does_not_match_a_node_with_combined_messages(self): node_labels = [("%snode" % i, 'small&&ovh') for i in range(10)] api_message = ';'.join( [BecauseLabelIsMissing % i for i in node_labels]) assert util.from_node_without_label(api_message) is None
def test_does_not_match_a_node(self): assert util.from_node_without_label(self.msg) is None