def test_matches_node_with_plus_sign_from_name(self): msg = BecauseNodeIsBusy % 'wheezy__192.168.1.12' assert util.from_label(msg) == 'wheezy'
def test_string_is_right_and_matches_node_from_name(self): msg = BecauseNodeIsBusy % 'wheezy' self.default_conf['nodes']['wheezy']['labels'] = [] set_config(self.default_conf, overwrite=True) assert util.from_label(msg) == 'wheezy'
def test_string_is_right_and_matches_node_from_label(self): msg = BecauseNodeIsBusy % 'amd64' assert util.from_label(msg) == 'wheezy'
def test_string_is_wrong_does_not_match(self): self.default_conf['nodes'] = {} set_config(self.default_conf, overwrite=True) assert util.from_label('this is not garbage') is None
def test_string_is_right_but_does_not_match(self): msg = BecauseNodeIsBusy % 'wheezy' self.default_conf['nodes'] = {} set_config(self.default_conf, overwrite=True) assert util.from_label(msg) is None
def test_string_is_right_but_does_not_match(self): msg = BecauseNodeIsBusy % "wheezy" set_config({"nodes": {}}, overwrite=True) assert util.from_label(msg) is None
def test_string_is_garbage(self): assert util.from_label('') is None
def test_string_is_right_and_matches_node_from_name(self): msg = BecauseNodeIsBusy % "wheezy" set_config({"nodes": {"wheezy": {"labels": []}}}) assert util.from_label(msg) == "wheezy"
def test_no_match_with_plus_sign_from_name(self): msg = BecauseNodeIsBusy % 'centos6__192.168.1.12' assert util.from_label(msg) is None
def test_label_is_busy_unicode(self): msg = BecauseLabelIsBusy % 'huge&&amd64' assert util.from_label(msg) == 'wheezy'
def test_string_is_wrong_does_not_match(self): set_config({"nodes": {}}, overwrite=True) assert util.from_label("this is not garbage") is None