summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-01-26 13:41:39 +0100
committerEndi S. Dewata <edewata@redhat.com>2012-01-26 10:20:54 -0600
commit6863b8fe409f6f267597955376e20df21cfd2dae (patch)
tree333490e5570aa37106793872261bbf20b8d84c83 /tests
parent71aa3d8d4ae49261f445bfa2ee3848d0e1f5a19f (diff)
downloadfreeipa.git-6863b8fe409f6f267597955376e20df21cfd2dae.tar.gz
freeipa.git-6863b8fe409f6f267597955376e20df21cfd2dae.tar.xz
freeipa.git-6863b8fe409f6f267597955376e20df21cfd2dae.zip
Add missing managing hosts filtering options
Host object has a virtual attribute "managing" containing all hosts it manages (governed by managedBy attribute). This patch also adds standard membership filtering options: --man-hosts=HOSTS: Only hosts managing _all_ HOSTS are returned --not-man-hosts=HOSTS: Only hosts which do not manage _any_ host in HOSTS are returned https://fedorahosted.org/freeipa/ticket/1675
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_host_plugin.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_host_plugin.py b/tests/test_xmlrpc/test_host_plugin.py
index 9459aec3..372ee256 100644
--- a/tests/test_xmlrpc/test_host_plugin.py
+++ b/tests/test_xmlrpc/test_host_plugin.py
@@ -391,6 +391,39 @@ class test_host(Declarative):
),
dict(
+ desc='Search for hosts with --man-hosts and --not-man-hosts',
+ command=('host_find', [], {'man_host' : fqdn3, 'not_man_host' : fqdn1}),
+ expected=dict(
+ count=1,
+ truncated=False,
+ summary=u'1 host matched',
+ result=[
+ dict(
+ dn=lambda x: DN(x) == dn3,
+ fqdn=[fqdn3],
+ description=[u'Test host 2'],
+ l=[u'Undisclosed location 2'],
+ krbprincipalname=[u'host/%s@%s' % (fqdn3, api.env.realm)],
+ has_keytab=False,
+ has_password=False,
+ managedby_host=[u'%s' % fqdn3, u'%s' % fqdn1],
+ ),
+ ],
+ ),
+ ),
+
+ dict(
+ desc='Try to search for hosts with --man-hosts',
+ command=('host_find', [], {'man_host' : [fqdn3,fqdn4]}),
+ expected=dict(
+ count=0,
+ truncated=False,
+ summary=u'0 hosts matched',
+ result=[],
+ ),
+ ),
+
+ dict(
desc='Remove managedby_host %r from %r' % (fqdn1, fqdn3),
command=('host_remove_managedby', [fqdn3],
dict(