test_dns_plugin: cope with missing IPv6 in Travis

If IPv6 is not enabled, cope with the possibility to get incomplete
output back from the IPA CLI.

To do so, use lambda to analyze the result rather than explicit
comparison with the expected output.

Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Alexander Bokovoy 2017-11-28 22:48:45 +02:00
parent 868c7e7c91
commit 64f4c71dd6

View File

@ -1107,23 +1107,12 @@ class test_dns(Declarative):
'options' % (name1, zone1)),
command=('dnsrecord_show', [zone1, name1],
{'structured': True, 'all': True}),
expected={
'value': name1_dnsname,
'summary': None,
'result': {
'dn': name1_dn,
'idnsname': [name1_dnsname],
'objectclass': objectclasses.dnsrecord,
'dnsrecords': [
{u'aaaa_part_ip_address': aaaarec1,
u'dnsdata': aaaarec1,
u'dnstype': u'AAAA'},
{u'a_part_ip_address': arec3,
u'dnsdata': arec3,
u'dnstype': u'A'}
],
},
},
expected=lambda o, x: (
'result' in x and
'dnsrecords' in x['result'] and
(len(x['result']['dnsrecords']) in (1, 2)) and
(any(y[u'dnsdata'] in (aaaarec1, arec3)
for y in x['result']['dnsrecords']))),
),
dict(