Example #1
0
 def test_success(self):
     xml = """
     <cib>
         <acls>
             <acl_permission id="permission-id"/>
             <acl_permission id="permission-id2"/>
         </acls>
     </cib>
     """
     assert_xml_equal(
         '<acl_permission id="permission-id"/>',
         etree.tostring(lib._find_permission(
             etree.XML(xml), "permission-id")
         ).decode()
     )
Example #2
0
 def test_not_exist(self):
     xml = """
     <cib>
         <acls>
             <acl_permission id="permission-id2"/>
         </acls>
     </cib>
     """
     assert_raise_library_error(
         lambda: lib._find_permission(etree.XML(xml), "permission-id"),
         (
             severities.ERROR,
             report_codes.ID_NOT_FOUND,
             {
                 "id": "permission-id",
                 "id_description": "permission",
             }
         )
     )