mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add sudorule and hbacrule to memberof and indirectmemberof attributes
Add Add tests for users, groups, hosts and hostgroups to verify membership Update API to version 2.3 https://fedorahosted.org/freeipa/ticket/1170
This commit is contained in:
committed by
Rob Crittenden
parent
4080a03051
commit
d7c60205a6
@@ -24,7 +24,6 @@ from xmlrpc_test import XMLRPC_test, assert_attr_equal
|
||||
from ipalib import api
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
class test_hbac(XMLRPC_test):
|
||||
"""
|
||||
Test the `hbacrule` plugin.
|
||||
@@ -179,6 +178,24 @@ class test_hbac(XMLRPC_test):
|
||||
assert_attr_equal(entry, 'memberuser_user', self.test_user)
|
||||
assert_attr_equal(entry, 'memberuser_group', self.test_group)
|
||||
|
||||
def test_9_a_show_user(self):
|
||||
"""
|
||||
Test showing a user to verify HBAC rule membership
|
||||
`xmlrpc.user_show`.
|
||||
"""
|
||||
ret = api.Command['user_show'](self.test_user, all=True)
|
||||
entry = ret['result']
|
||||
assert_attr_equal(entry, 'memberof_HBAC rule', self.rule_name)
|
||||
|
||||
def test_9_b_show_group(self):
|
||||
"""
|
||||
Test showing a group to verify HBAC rule membership
|
||||
`xmlrpc.group_show`.
|
||||
"""
|
||||
ret = api.Command['group_show'](self.test_group, all=True)
|
||||
entry = ret['result']
|
||||
assert_attr_equal(entry, 'memberof_HBAC rule', self.rule_name)
|
||||
|
||||
def test_9_hbacrule_remove_user(self):
|
||||
"""
|
||||
Test removing user and group from HBAC rule using `xmlrpc.hbacrule_remove_user'.
|
||||
@@ -215,6 +232,24 @@ class test_hbac(XMLRPC_test):
|
||||
assert_attr_equal(entry, 'memberhost_host', self.test_host)
|
||||
assert_attr_equal(entry, 'memberhost_hostgroup', self.test_hostgroup)
|
||||
|
||||
def test_a_hbacrule_show_host(self):
|
||||
"""
|
||||
Test showing host to verify HBAC rule membership
|
||||
`xmlrpc.host_show`.
|
||||
"""
|
||||
ret = api.Command['host_show'](self.test_host, all=True)
|
||||
entry = ret['result']
|
||||
assert_attr_equal(entry, 'memberof_HBAC rule', self.rule_name)
|
||||
|
||||
def test_a_hbacrule_show_hostgroup(self):
|
||||
"""
|
||||
Test showing hostgroup to verify HBAC rule membership
|
||||
`xmlrpc.hostgroup_show`.
|
||||
"""
|
||||
ret = api.Command['hostgroup_show'](self.test_hostgroup, all=True)
|
||||
entry = ret['result']
|
||||
assert_attr_equal(entry, 'memberof_HBAC rule', self.rule_name)
|
||||
|
||||
def test_b_hbacrule_remove_host(self):
|
||||
"""
|
||||
Test removing host and hostgroup from HBAC rule using `xmlrpc.hbacrule_remove_host`.
|
||||
|
||||
@@ -25,7 +25,6 @@ from xmlrpc_test import XMLRPC_test, assert_attr_equal
|
||||
from ipalib import api
|
||||
from ipalib import errors
|
||||
|
||||
|
||||
class test_sudorule(XMLRPC_test):
|
||||
"""
|
||||
Test the `sudorule` plugin.
|
||||
@@ -155,6 +154,24 @@ class test_sudorule(XMLRPC_test):
|
||||
assert_attr_equal(entry, 'memberuser_user', self.test_user)
|
||||
assert_attr_equal(entry, 'memberuser_group', self.test_group)
|
||||
|
||||
def test_9_a_show_user(self):
|
||||
"""
|
||||
Test showing a user to verify Sudo rule membership
|
||||
`xmlrpc.user_show`.
|
||||
"""
|
||||
ret = api.Command['user_show'](self.test_user, all=True)
|
||||
entry = ret['result']
|
||||
assert_attr_equal(entry, 'memberof_Sudo Rule', self.rule_name)
|
||||
|
||||
def test_9_b_show_group(self):
|
||||
"""
|
||||
Test showing a group to verify Sudo rule membership
|
||||
`xmlrpc.group_show`.
|
||||
"""
|
||||
ret = api.Command['group_show'](self.test_group, all=True)
|
||||
entry = ret['result']
|
||||
assert_attr_equal(entry, 'memberof_Sudo Rule', self.rule_name)
|
||||
|
||||
def test_9_sudorule_remove_user(self):
|
||||
"""
|
||||
Test removing user and group from Sudo rule using
|
||||
@@ -359,6 +376,24 @@ class test_sudorule(XMLRPC_test):
|
||||
assert_attr_equal(entry, 'memberhost_host', self.test_host)
|
||||
assert_attr_equal(entry, 'memberhost_hostgroup', self.test_hostgroup)
|
||||
|
||||
def test_a_sudorule_show_host(self):
|
||||
"""
|
||||
Test showing host to verify Sudo rule membership
|
||||
`xmlrpc.host_show`.
|
||||
"""
|
||||
ret = api.Command['host_show'](self.test_host, all=True)
|
||||
entry = ret['result']
|
||||
assert_attr_equal(entry, 'memberof_Sudo Rule', self.rule_name)
|
||||
|
||||
def test_a_sudorule_show_hostgroup(self):
|
||||
"""
|
||||
Test showing hostgroup to verify Sudo rule membership
|
||||
`xmlrpc.hostgroup_show`.
|
||||
"""
|
||||
ret = api.Command['hostgroup_show'](self.test_hostgroup, all=True)
|
||||
entry = ret['result']
|
||||
assert_attr_equal(entry, 'memberof_Sudo Rule', self.rule_name)
|
||||
|
||||
def test_b_sudorule_remove_host(self):
|
||||
"""
|
||||
Test removing host and hostgroup from Sudo rule using
|
||||
|
||||
Reference in New Issue
Block a user