Imported Upstream version 4.7.2

This commit is contained in:
Mario Fetka
2021-08-09 20:54:00 +02:00
parent 3bfaa6e020
commit a791de49a2
2175 changed files with 1764288 additions and 331861 deletions

View File

@@ -18,13 +18,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Test the `ipalib/plugins/privilege.py` module.
Test the `ipaserver/plugins/privilege.py` module.
"""
from ipalib import api, errors
from ipatests.test_xmlrpc import objectclasses
from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid
from ipatests.test_xmlrpc.xmlrpc_test import Declarative
from ipapython.dn import DN
import pytest
permission1 = u'testperm'
permission1_dn = DN(('cn',permission1),
@@ -41,6 +42,7 @@ privilege1_dn = DN(('cn',privilege1),
users_dn = DN(api.env.container_user, api.env.basedn)
@pytest.mark.tier1
class test_privilege(Declarative):
cleanup_commands = [
@@ -147,7 +149,6 @@ class test_privilege(Declarative):
'cn': [privilege1],
'description': [u'privilege desc. 1'],
'memberof_permission': [permission1],
'objectclass': objectclasses.privilege,
}
),
),
@@ -170,8 +171,8 @@ class test_privilege(Declarative):
dict(
desc='Search for %r' % privilege1,
command=('privilege_find', [privilege1], {}),
desc='Search for %r with members' % privilege1,
command=('privilege_find', [privilege1], {'no_members': False}),
expected=dict(
count=1,
truncated=False,
@@ -191,6 +192,24 @@ class test_privilege(Declarative):
dict(
desc='Search for %r' % privilege1,
command=('privilege_find', [privilege1], {}),
expected=dict(
count=1,
truncated=False,
summary=u'1 privilege matched',
result=[
{
'dn': privilege1_dn,
'cn': [privilege1],
'description': [u'privilege desc. 1'],
},
],
),
),
dict(
desc='Search for %r with members' % privilege1,
command=('privilege_find', [privilege1], {'no_members': False}),
expected=dict(
count=1,
truncated=False,
@@ -207,6 +226,24 @@ class test_privilege(Declarative):
),
dict(
desc='Search for %r' % privilege1,
command=('privilege_find', [privilege1], {}),
expected=dict(
count=1,
truncated=False,
summary=u'1 privilege matched',
result=[
{
'dn': privilege1_dn,
'cn': [privilege1],
'description': [u'privilege desc. 1'],
},
],
),
),
dict(
desc='Create %r' % permission2,
command=(
@@ -249,7 +286,6 @@ class test_privilege(Declarative):
'cn': [privilege1],
'description': [u'privilege desc. 1'],
'memberof_permission': [permission1, permission2],
'objectclass': objectclasses.privilege,
}
),
),
@@ -272,12 +308,30 @@ class test_privilege(Declarative):
'cn': [privilege1],
'description': [u'privilege desc. 1'],
'memberof_permission': [permission1, permission2],
'objectclass': objectclasses.privilege,
}
),
),
dict(
desc='Search for %r with memebers' % privilege1,
command=('privilege_find', [privilege1], {'no_members': False}),
expected=dict(
count=1,
truncated=False,
summary=u'1 privilege matched',
result=[
{
'dn': privilege1_dn,
'cn': [privilege1],
'description': [u'privilege desc. 1'],
'memberof_permission': [permission1, permission2],
},
],
),
),
dict(
desc='Search for %r' % privilege1,
command=('privilege_find', [privilege1], {}),
@@ -290,7 +344,6 @@ class test_privilege(Declarative):
'dn': privilege1_dn,
'cn': [privilege1],
'description': [u'privilege desc. 1'],
'memberof_permission': [permission1, permission2],
},
],
),
@@ -331,7 +384,6 @@ class test_privilege(Declarative):
'cn': [privilege1],
'description': [u'New desc 1'],
'memberof_permission': [permission2],
'objectclass': objectclasses.privilege,
}
),
),
@@ -354,7 +406,6 @@ class test_privilege(Declarative):
'cn': [privilege1],
'description': [u'New desc 1'],
'memberof_permission': [permission2],
'objectclass': objectclasses.privilege,
}
),
),
@@ -377,7 +428,6 @@ class test_privilege(Declarative):
'cn': [privilege1],
'description': [u'New desc 1'],
'memberof_permission': [permission2],
'objectclass': objectclasses.privilege,
}
),
),
@@ -400,7 +450,6 @@ class test_privilege(Declarative):
'cn': [privilege1],
'description': [u'New desc 1'],
'memberof_permission': [permission2],
'objectclass': objectclasses.privilege,
}
),
),