def assert_return_resources(self, identifier):
     resources_section = etree.fromstring("""
         <resources>
             <primitive id="RESOURCE_ID">
                 <meta_attributes>
                     <nvpair name="remote-node" value="NODE_NAME" />
                     <nvpair name="remote-addr" value="NODE_HOST" />
                 </meta_attributes>
             </primitive>
         </resources>
     """)
     self.assertEquals(
         "RESOURCE_ID",
         guest_node.find_node_resources(resources_section,
                                        identifier)[0].attrib["id"])
 def assert_return_resources(self,
                             identifier,
                             resources_section_xml=None,
                             found=True):
     if resources_section_xml is None:
         resources_section_xml = """
             <resources>
                 <primitive id="RESOURCE_ID">
                     <meta_attributes>
                         <nvpair name="remote-node" value="NODE_NAME" />
                         <nvpair name="remote-addr" value="NODE_HOST" />
                     </meta_attributes>
                 </primitive>
             </resources>
         """
     resources_section = etree.fromstring(resources_section_xml)
     resources = guest_node.find_node_resources(resources_section,
                                                identifier)
     if not found:
         self.assertEqual([], resources)
     else:
         self.assertTrue(resources)
         self.assertEqual("RESOURCE_ID", resources[0].attrib["id"])
 def assert_return_resources(
     self, identifier, resources_section_xml=None, found=True
 ):
     if resources_section_xml is None:
         resources_section_xml = """
             <resources>
                 <primitive id="RESOURCE_ID">
                     <meta_attributes>
                         <nvpair name="remote-node" value="NODE_NAME" />
                         <nvpair name="remote-addr" value="NODE_HOST" />
                     </meta_attributes>
                 </primitive>
             </resources>
         """
     resources_section = etree.fromstring(resources_section_xml)
     resources = guest_node.find_node_resources(
         resources_section, identifier
     )
     if not found:
         self.assertEqual([], resources)
     else:
         self.assertTrue(resources)
         self.assertEqual("RESOURCE_ID", resources[0].attrib["id"])
 def test_no_result_when_no_guest_nodes(self):
     resources_section = etree.fromstring(
         '<resources><primitive id="RESOURCE_ID"/></resources>')
     self.assertEquals([],
                       guest_node.find_node_resources(
                           resources_section, "RESOURCE_ID"))