def test_parameters_minimal(self): self.assertEqual( self.parse( self.xml(""" <resource-agent> <parameters> <parameter name="a_parameter"/> </parameters> </resource-agent> """)), ResourceAgentMetadataOcf1_0( self.agent_name, shortdesc=None, longdesc=None, parameters=[ ResourceAgentParameterOcf1_0( name="a_parameter", shortdesc=None, longdesc=None, type="string", default=None, enum_values=None, required=None, deprecated=None, obsoletes=None, unique=None, ) ], actions=[], ), )
def test_actions_multiple(self): self.assertEqual( self.parse( self.xml( """ <resource-agent> <actions> <action name="minimal"/> <action name="maximal" timeout="1" interval="2" start-delay="3" depth="4" role="Master" /> <action name="stonith_special" automatic="0" on_target="1" /> </actions> </resource-agent> """ ) ), ResourceAgentMetadataOcf1_0( self.agent_name, shortdesc=None, longdesc=None, parameters=[], actions=[ ResourceAgentActionOcf1_0( name="minimal", timeout=None, interval=None, role=None, start_delay=None, depth=None, automatic=None, on_target=None, ), ResourceAgentActionOcf1_0( name="maximal", timeout="1", interval="2", role="Master", start_delay="3", depth="4", automatic=None, on_target=None, ), ResourceAgentActionOcf1_0( name="stonith_special", timeout=None, interval=None, role=None, start_delay=None, depth=None, automatic="0", on_target="1", ), ], ), )
def test_parameters_content(self): self.assertEqual( self.parse( self.xml( """ <resource-agent> <parameters> <parameter name="with_type"> <content type="integer"/> </parameter> <parameter name="with_select"> <content type="select" default="b"> <option value="a"/> <option value="b"/> <option value="c"/> </content> </parameter> </parameters> </resource-agent> """ ) ), ResourceAgentMetadataOcf1_0( self.agent_name, shortdesc=None, longdesc=None, parameters=[ ResourceAgentParameterOcf1_0( name="with_type", shortdesc=None, longdesc=None, type="integer", default=None, enum_values=None, required=None, deprecated=None, obsoletes=None, unique=None, ), ResourceAgentParameterOcf1_0( name="with_select", shortdesc=None, longdesc=None, type="select", default="b", enum_values=["a", "b", "c"], required=None, deprecated=None, obsoletes=None, unique=None, ), ], actions=[], ), )
def test_empty_agent(self): self.assertEqual( self.parse(self.xml("""<resource-agent/>""")), ResourceAgentMetadataOcf1_0( self.agent_name, shortdesc=None, longdesc=None, parameters=[], actions=[], ), )
def test_desc_element_empty_and_attribute_empty(self): self.assertEqual( self.parse( self.xml(""" <resource-agent shortdesc=""> <shortdesc></shortdesc> </resource-agent> """)), ResourceAgentMetadataOcf1_0( self.agent_name, shortdesc="", longdesc=None, parameters=[], actions=[], ), )
def test_desc_attribute(self): self.assertEqual( self.parse( self.xml(""" <resource-agent shortdesc="This is a shortdesc"> <longdesc></longdesc> </resource-agent> """)), ResourceAgentMetadataOcf1_0( self.agent_name, shortdesc="This is a shortdesc", longdesc=None, parameters=[], actions=[], ), )
def test_desc_element(self): self.assertEqual( self.parse( self.xml(""" <resource-agent> <shortdesc>This is a shortdesc</shortdesc> <longdesc>This is a longdesc</longdesc> </resource-agent> """)), ResourceAgentMetadataOcf1_0( self.agent_name, shortdesc="This is a shortdesc", longdesc="This is a longdesc", parameters=[], actions=[], ), )
def test_parameters_all_settings(self): self.assertEqual( self.parse( self.xml( """ <resource-agent> <parameters> <parameter name="a_parameter" required="1" unique="0" deprecated="1" obsoletes="old" > <longdesc>Long description</longdesc> <shortdesc>short description</shortdesc> <content type="integer" default="123"/> </parameter> </parameters> </resource-agent> """ ) ), ResourceAgentMetadataOcf1_0( self.agent_name, shortdesc=None, longdesc=None, parameters=[ ResourceAgentParameterOcf1_0( name="a_parameter", shortdesc="short description", longdesc="Long description", type="integer", default="123", enum_values=None, required="1", deprecated="1", obsoletes="old", unique="0", ) ], actions=[], ), )