summaryrefslogtreecommitdiffstats
path: root/tests/test_xmlrpc/test_pwpolicy.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-03-12 18:00:00 -0500
committerJason Gerard DeRose <jderose@redhat.com>2010-03-19 07:13:33 -0600
commitd13fcb6a0c6702e000705d9366b4d1e519fa632f (patch)
treeb05d57e67a5a3d2149df727054d80c4cf66df0f5 /tests/test_xmlrpc/test_pwpolicy.py
parentff4ddbbb72512259179d7021a5ff5c313e2fdbfe (diff)
downloadfreeipa-d13fcb6a0c6702e000705d9366b4d1e519fa632f.tar.gz
freeipa-d13fcb6a0c6702e000705d9366b4d1e519fa632f.tar.xz
freeipa-d13fcb6a0c6702e000705d9366b4d1e519fa632f.zip
Ensure that the group policy priority is unique.
We use CoS to determine the order in which group policy is applied. The behavior in CoS is undefined for multiple entries with the same cospriority.
Diffstat (limited to 'tests/test_xmlrpc/test_pwpolicy.py')
-rw-r--r--tests/test_xmlrpc/test_pwpolicy.py43
1 files changed, 35 insertions, 8 deletions
diff --git a/tests/test_xmlrpc/test_pwpolicy.py b/tests/test_xmlrpc/test_pwpolicy.py
index ceb4f8b62..1a34c02ae 100644
--- a/tests/test_xmlrpc/test_pwpolicy.py
+++ b/tests/test_xmlrpc/test_pwpolicy.py
@@ -57,16 +57,32 @@ class test_pwpolicy(XMLRPC_test):
def test_2_pwpolicy_add(self):
"""
+ Add a policy with a duplicate priority
+
+ The priority validation is done first so it's ok that the group
+ is the same here.
+ """
+ try:
+ api.Command['pwpolicy_add'](**self.kw)
+ except errors.ValidationError:
+ pass
+ else:
+ assert False
+
+ def test_3_pwpolicy_add(self):
+ """
Add a policy that already exists
"""
try:
+ # cospriority needs to be unique
+ self.kw['cospriority'] = 3
api.Command['pwpolicy_add'](**self.kw)
except errors.DuplicateEntry:
pass
else:
assert False
- def test_3_pwpolicy_add(self):
+ def test_4_pwpolicy_add(self):
"""
Test adding another per-group policy using the `xmlrpc.pwpolicy_add` method.
"""
@@ -79,18 +95,18 @@ class test_pwpolicy(XMLRPC_test):
assert_attr_equal(entry, 'krbpwdhistorylength', '8')
assert_attr_equal(entry, 'krbpwdminlength', '9')
- def test_4_pwpolicy_add(self):
+ def test_5_pwpolicy_add(self):
"""
Add a pwpolicy for a non-existent group
"""
try:
- api.Command['pwpolicy_add'](group=u'nopwpolicy',cospriority=1,krbminpwdlife=1)
+ api.Command['pwpolicy_add'](group=u'nopwpolicy',cospriority=4,krbminpwdlife=1)
except errors.NotFound:
pass
else:
assert False
- def test_5_pwpolicy_show(self):
+ def test_6_pwpolicy_show(self):
"""
Test the `xmlrpc.pwpolicy_show` method with global policy.
"""
@@ -101,7 +117,7 @@ class test_pwpolicy(XMLRPC_test):
assert_attr_equal(entry, 'krbpwdhistorylength', '0')
assert_attr_equal(entry, 'krbpwdminlength', '8')
- def test_6_pwpolicy_show(self):
+ def test_7_pwpolicy_show(self):
"""
Test the `xmlrpc.pwpolicy_show` method.
"""
@@ -111,7 +127,7 @@ class test_pwpolicy(XMLRPC_test):
assert_attr_equal(entry, 'krbpwdhistorylength', '5')
assert_attr_equal(entry, 'krbpwdminlength', '6')
- def test_7_pwpolicy_mod(self):
+ def test_8_pwpolicy_mod(self):
"""
Test the `xmlrpc.pwpolicy_mod` method for global policy.
"""
@@ -122,14 +138,25 @@ class test_pwpolicy(XMLRPC_test):
entry = api.Command['pwpolicy_mod'](krbminpwdlife=1)['result']
assert_attr_equal(entry, 'krbminpwdlife', '1')
- def test_8_pwpolicy_mod(self):
+ def test_9_pwpolicy_mod(self):
"""
Test the `xmlrpc.pwpolicy_mod` method.
"""
entry = api.Command['pwpolicy_mod'](group=self.group, krbminpwdlife=50)['result']
assert_attr_equal(entry, 'krbminpwdlife', '50')
- def test_9_pwpolicy_del(self):
+ def test_a_pwpolicy_mod(self):
+ """
+ Test `xmlrpc.pwpolicy_mod` with a duplicate priority
+ """
+ try:
+ api.Command['pwpolicy_mod'](group=self.group, cospriority=1)
+ except errors.ValidationError:
+ pass
+ else:
+ assert False
+
+ def test_b_pwpolicy_del(self):
"""
Test the `xmlrpc.pwpolicy_del` method.
"""