Esempio n. 1
0
 def test_name_only(self):
     xml = '''
         <action name="required" />
     '''
     self.assertEqual(
         lib_ra._get_action(etree.XML(xml)), {"name": "required"}
     )
Esempio n. 2
0
 def test_name_and_params(self):
     xml = '''
         <action name="required" param="value" another_param="same_value" />
     '''
     self.assertEqual(
         lib_ra._get_action(etree.XML(xml)),
         {
             "name": "required",
             "another_param": "same_value",
             "param": "value"
         }
     )
Esempio n. 3
0
 def test_root_is_not_resource_agent(self):
     xml = """
         <agent>
             <actions>
                 <action name="on" automatic="0"/>
                 <action name="off" />
             </actions>
         </agent>
     """
     self.assertRaises(
         lib_ra.InvalidMetadataFormat,
         lambda: lib_ra._get_action(etree.XML(xml))
     )
Esempio n. 4
0
 def test_action_without_name(self):
     xml = """
         <resource-agent>
             <actions>
                 <action name="on" automatic="0"/>
                 <action />
                 <action name="reboot" />
                 <action name="status" />
             </actions>
         </resource-agent>
     """
     self.assertRaises(
         lib_ra.InvalidMetadataFormat,
         lambda: lib_ra._get_action(etree.XML(xml))
     )
Esempio n. 5
0
 def test_not_action_element(self):
     xml = '<actions param="value" another_param="same_value" />'
     self.assertRaises(
         lib_ra.InvalidMetadataFormat,
         lambda: lib_ra._get_action(etree.XML(xml))
     )
Esempio n. 6
0
 def test_empty(self):
     xml = '<action />'
     self.assertRaises(
         lib_ra.InvalidMetadataFormat,
         lambda: lib_ra._get_action(etree.XML(xml))
     )