def test_empty_actions(self): xml = """ <resource-agent> <actions /> </resource-agent> """ self.assertEqual(len(lib_ra.get_agent_actions(etree.XML(xml))), 0)
def stonith_does_agent_provide_unfencing(metadata_dom): for action in lib_ra.get_agent_actions(metadata_dom): if ( action["name"] == "on" and "on_target" in action and action["on_target"] == "1" and "automatic" in action and action["automatic"] == "1" ): return True return False
def test_multiple_actions(self): xml = """ <resource-agent> <actions> <action name="on" automatic="0"/> <action name="off" /> <action name="reboot" /> <action name="status" /> </actions> </resource-agent> """ self.assertEqual( lib_ra.get_agent_actions(etree.XML(xml)), [ { "name": "on", "automatic": "0" }, {"name": "off"}, {"name": "reboot"}, {"name": "status"} ] )
def test_no_actions(self): xml = "<resource-agent />" self.assertEqual(len(lib_ra.get_agent_actions(etree.XML(xml))), 0)