def _comp_host(self, selection, expected_namespace, expected_host): """ Helper function for test_parse_selection_positive """ sel = HostSelection.parseSelection(selection) print sel[0], expected_namespace assert cmp(sel[0], expected_namespace) == 0, "The Namespace is wrong" print sel[1], expected_host assert sel[1] == expected_host, "The Host is wrong"
def test_parse_selection_negative(self): """ Parse the String pattern into a namespace and host selection """ try: HostSelection.parseSelection("/A/B/C/:host") assert False, "There was supposed to be an exception" except hostslist.HostException: pass try: HostSelection.parseSelection("/A/B//C:host") assert False, "There was supposed to be an exception" except hostslist.HostException: pass try: HostSelection.parseSelection("/A/B /C:host") assert False, "There was supposed to be an exception" except hostslist.HostException: pass