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,10 +18,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Test the `ipalib/plugins/pwpolicy.py` module.
Test the `ipaserver/plugins/pwpolicy.py` module.
"""
from nose.tools import assert_raises # pylint: disable=E0611
import pytest
from ipalib import api
from ipalib import errors
@@ -31,6 +31,7 @@ from ipatests.test_xmlrpc.xmlrpc_test import (XMLRPC_test, assert_attr_equal,
Declarative)
@pytest.mark.tier1
class test_pwpolicy(XMLRPC_test):
"""
Test the `pwpolicy` plugin.
@@ -161,7 +162,8 @@ class test_pwpolicy(XMLRPC_test):
Test adding password policy to a managed group.
"""
try:
entry = api.Command['pwpolicy_add'](self.user, krbminpwdlife=50, cospriority=2)['result']
api.Command['pwpolicy_add'](
self.user, krbminpwdlife=50, cospriority=2)
except errors.ManagedPolicyError:
pass
else:
@@ -195,7 +197,7 @@ class test_pwpolicy(XMLRPC_test):
# Test that returned values match the arguments
# Only test the second and third results; the first one was modified
for entry, expected in (result[1], self.kw2), (result[2], self.kw3):
for name, value in expected.iteritems():
for name, value in expected.items():
assert_attr_equal(entry, name, str(value))
def test_c_pwpolicy_find_pkey_only(self):
@@ -210,7 +212,7 @@ class test_pwpolicy(XMLRPC_test):
def test_d_pwpolicy_show(self):
"""Test that deleting a group removes its pwpolicy"""
api.Command['group_del'](self.group3)
with assert_raises(errors.NotFound):
with pytest.raises(errors.NotFound):
api.Command['pwpolicy_show'](self.group3)
def test_e_pwpolicy_del(self):
@@ -246,6 +248,7 @@ class test_pwpolicy(XMLRPC_test):
api.Command['user_del'](self.user)
@pytest.mark.tier1
class test_pwpolicy_mod_cospriority(Declarative):
"""Tests for cospriority modifications"""
cleanup_commands = [