test_helpers.py 363 B

1234567891011
  1. from salt._compat import ElementTree as ET
  2. def append_to_XMLDesc(mocked, fragment):
  3. """
  4. Append an XML fragment at the end of the mocked XMLDesc return_value of mocked.
  5. """
  6. xml_doc = ET.fromstring(mocked.XMLDesc())
  7. xml_fragment = ET.fromstring(fragment)
  8. xml_doc.append(xml_fragment)
  9. mocked.XMLDesc.return_value = ET.tostring(xml_doc)