mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-11-02 20:30:26 -06:00
Port ipapython.dnssec.odsmgr to xml.etree
The module ipapython.dnssec.odsmgr is the only module in ipalib, ipaclient, ipapython and ipaplatform that uses lxml.etree. https://fedorahosted.org/freeipa/ticket/6469 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
1 parent
8346e1b067
commit
64af88fee4
3 files changed
+64
-16
No files matched your search
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
|
||||
#
|
||||
"""
|
||||
Test the `ipapython/dnssec` package.
|
||||
"""
|
||||
import dns.name
|
||||
|
||||
from ipapython.dnssec.odsmgr import ODSZoneListReader
|
||||
|
||||
|
||||
ZONELIST_XML = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ZoneList>
|
||||
<Zone name="ipa.example">
|
||||
<Policy>default</Policy>
|
||||
<Adapters>
|
||||
<Input>
|
||||
<Adapter type="File">/var/lib/ipa/dns/zone/entryUUID/12345</Adapter>
|
||||
</Input>
|
||||
<Output>
|
||||
<Adapter type="File">/var/lib/ipa/dns/zone/entryUUID/12345</Adapter>
|
||||
</Output>
|
||||
</Adapters>
|
||||
</Zone>
|
||||
</ZoneList>
|
||||
"""
|
||||
|
||||
|
||||
def test_ods_zonelist_reader():
|
||||
uuid = '12345'
|
||||
name = dns.name.from_text('ipa.example.')
|
||||
|
||||
reader = ODSZoneListReader("<ZoneList/>")
|
||||
assert reader.mapping == {}
|
||||
assert reader.names == set()
|
||||
assert reader.uuids == set()
|
||||
|
||||
reader = ODSZoneListReader(ZONELIST_XML)
|
||||
assert reader.mapping == {uuid: name}
|
||||
assert reader.names == {name}
|
||||
assert reader.uuids == {uuid}
|
||||
Reference in new issue
Block a user