Beispiel #1
0
 def test_no_parameters(self):
     xml = """
         <resource-agent>
             <longdesc />
         </resource-agent>
     """
     self.assertEqual(0, len(lib_ra._get_agent_parameters(etree.XML(xml))))
Beispiel #2
0
 def test_invalid_format(self):
     xml = """
         <resource-agent>
             <parameters>
                 <parameter />
             </parameters>
         </resource-agent>
     """
     self.assertRaises(
         lib_ra.InvalidMetadataFormat,
         lambda: lib_ra._get_agent_parameters(etree.XML(xml))
     )
 def test_invalid_format(self):
     xml = """
         <resource-agent>
             <parameters>
                 <parameter />
             </parameters>
         </resource-agent>
     """
     self.assert_raise_library_error(
         lambda: lib_ra._get_agent_parameters(etree.XML(xml)),
         (
             Severities.ERROR,
             error_codes.INVALID_METADATA_FORMAT,
             {}
         )
     )
Beispiel #4
0
 def test_all_data(self):
     xml = """
         <resource-agent>
             <parameters>
                 <parameter name="test_param" required="1">
                     <longdesc>
                         Long description
                     </longdesc>
                     <shortdesc>short description</shortdesc>
                     <content type="test_type" default="default_value" />
                 </parameter>
                 <parameter name="another parameter"/>
             </parameters>
         </resource-agent>
     """
     self.assertEqual(
         [
             {
                 "name": "test_param",
                 "longdesc": "Long description",
                 "shortdesc": "short description",
                 "type": "test_type",
                 "required": True,
                 "default": "default_value"
             },
             {
                 "name": "another parameter",
                 "longdesc": "",
                 "shortdesc": "",
                 "type": "string",
                 "required": False,
                 "default": None
             }
         ],
         lib_ra._get_agent_parameters(etree.XML(xml))
     )