I found a few test failures that have resulted from some recent commits. These got lost in the mix of "expected" failures when I did initial testing on them. This has inspired me to try to fix all the test failures (see patch 817 too).

This fixes:
- an error in a new exception example
- the case of boolean values in nsAccountLock
- a change in the updater code

rob
>From a88cb937ee2d7acb996a0202a106f817c3a39f0d Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcrit...@redhat.com>
Date: Fri, 1 Jul 2011 15:20:36 -0400
Subject: [PATCH 1/4] Fix error in AttrValueNotFound exception example

---
 ipalib/errors.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipalib/errors.py b/ipalib/errors.py
index e118db192c2b4694a8f729242cde9ec94b6f30ba..74bc5f679502f91f860e2f376620a37d98dc9746 100644
--- a/ipalib/errors.py
+++ b/ipalib/errors.py
@@ -1197,10 +1197,10 @@ class AttrValueNotFound(ExecutionError):
 
     For example:
 
-    >>> raise NotFound(attr='ipasudoopt', value='authenticate')
+    >>> raise AttrValueNotFound(attr='ipasudoopt', value='authenticate')
     Traceback (most recent call last):
       ...
-    AttrValueNotFound: ipasudoopt does not contain 'authenticate'.
+    AttrValueNotFound: ipasudoopt does not contain 'authenticate'
 
     """
 
-- 
1.7.4

>From 398fd71bdaf48ad6c2a5cf481aacbeadcf696fe6 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcrit...@redhat.com>
Date: Fri, 1 Jul 2011 15:21:03 -0400
Subject: [PATCH 2/4] Fix test failure in updater when adding values to a single-value attr

The ipaldap.py code was updated to consider the schema when making
changes and does a REPLACE on single-value attributes. So when you
do an add in an update it will effectively replace the value instead
of ignoring it.
---
 tests/test_install/4_update.update |    1 +
 tests/test_install/test_updates.py |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tests/test_install/4_update.update b/tests/test_install/4_update.update
index d02cfcd3cf588bc57be4dde8aaff479e7cf672b5..0aef7494fdc3b91145e79336366e7bbc0918091a 100644
--- a/tests/test_install/4_update.update
+++ b/tests/test_install/4_update.update
@@ -1,3 +1,4 @@
+# Replace the existing SINGLE-VALUE gecos with a new value thru add
 dn: uid=tuser, cn=test, cn=accounts, $SUFFIX
 add:gecos: Test User New2
 
diff --git a/tests/test_install/test_updates.py b/tests/test_install/test_updates.py
index 58cfc11a4d9770bcfcc0a2106071a86d49bb6705..eb376f19113e534563d02eae51a798f7b9d9c773 100644
--- a/tests/test_install/test_updates.py
+++ b/tests/test_install/test_updates.py
@@ -126,7 +126,7 @@ class test_update(object):
         Test the updater adding a new value to a single-valued attribute
         """
         modified = self.updater.update([self.testdir + "4_update.update"])
-        assert(modified == False)
+        assert(modified == True)
 
     def test_5_update(self):
         """
-- 
1.7.4

>From 02186422e475700e5768e8984a5f4b1351bea2c0 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcrit...@redhat.com>
Date: Fri, 1 Jul 2011 15:25:43 -0400
Subject: [PATCH 3/4] Fix the case of the boolean nsAccountLock attribute in the user plugin & tests

Boolean values are treated as upper-case in LDAP, we do the same now.
---
 ipalib/plugins/user.py                |    6 +++---
 tests/test_xmlrpc/test_attr.py        |   14 +++++++-------
 tests/test_xmlrpc/test_replace.py     |   12 ++++++------
 tests/test_xmlrpc/test_user_plugin.py |   22 +++++++++++-----------
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index 1f85238daeccb67349cd53242356f19c9e6b81ea..59a7308b399a8bfda468af0a7c272882b0c3f22d 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -429,7 +429,7 @@ class user_mod(LDAPUpdate):
 
     def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
         if not 'nsaccountlock' in entry_attrs:
-            entry_attrs['nsaccountlock'] = [u'False']
+            entry_attrs['nsaccountlock'] = [u'FALSE']
         self.obj._convert_manager(entry_attrs, **options)
         return dn
 
@@ -461,7 +461,7 @@ class user_find(LDAPSearch):
             (dn, attrs) = entry
             self.obj._convert_manager(attrs, **options)
             if not 'nsaccountlock' in attrs:
-                attrs['nsaccountlock'] = [u'False']
+                attrs['nsaccountlock'] = [u'FALSE']
 
     msg_summary = ngettext(
         '%(count)d user matched', '%(count)d users matched', 0
@@ -476,7 +476,7 @@ class user_show(LDAPRetrieve):
     """
     def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
         if not 'nsaccountlock' in entry_attrs:
-            entry_attrs['nsaccountlock'] = [u'False']
+            entry_attrs['nsaccountlock'] = [u'FALSE']
         self.obj._convert_manager(entry_attrs, **options)
         return dn
 
diff --git a/tests/test_xmlrpc/test_attr.py b/tests/test_xmlrpc/test_attr.py
index 198251fcd0401518420fff41514d403e2f8efd9c..5e3a9b71360a7ab38d7e009007da4dcaaad5a0d7 100644
--- a/tests/test_xmlrpc/test_attr.py
+++ b/tests/test_xmlrpc/test_attr.py
@@ -83,7 +83,7 @@ class test_attr(Declarative):
                     gidnumber=[fuzzy_digits],
                     mail=[u't...@example.com'],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -107,7 +107,7 @@ class test_attr(Declarative):
                     gidnumber=[fuzzy_digits],
                     mail=[u't...@example.com', u'te...@example.com'],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -132,7 +132,7 @@ class test_attr(Declarative):
                     mail=[u't...@example.com', u'te...@example.com'],
                     memberof_group=[u'ipausers'],
                     telephonenumber=[u'410-555-1212', u'301-555-1212'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -157,7 +157,7 @@ class test_attr(Declarative):
                     mail=[u't...@example.com', u'te...@example.com'],
                     memberof_group=[u'ipausers'],
                     telephonenumber=[u'301-555-1212'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -182,7 +182,7 @@ class test_attr(Declarative):
                     mail=[u't...@example.com', u'te...@example.com'],
                     memberof_group=[u'ipausers'],
                     telephonenumber=[u'301-555-1212', u'202-888-9833', u'703-555-1212'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -225,7 +225,7 @@ class test_attr(Declarative):
                     mail=[u't...@example.com', u'te...@example.com'],
                     memberof_group=[u'ipausers'],
                     telephonenumber=[u'301-555-1212', u'202-888-9833', u'703-555-1212'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -250,7 +250,7 @@ class test_attr(Declarative):
                     mail=[u't...@example.com', u'te...@example.com'],
                     memberof_group=[u'ipausers'],
                     telephonenumber=[u'301-555-1212', u'202-888-9833', u'703-555-1212'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
diff --git a/tests/test_xmlrpc/test_replace.py b/tests/test_xmlrpc/test_replace.py
index 931e487fafe4009fbe736b35a973cdf49d3913a4..f1334f5c803a321c7d6c1cf5bbe72418b6136bca 100644
--- a/tests/test_xmlrpc/test_replace.py
+++ b/tests/test_xmlrpc/test_replace.py
@@ -89,7 +89,7 @@ class test_replace(Declarative):
                     gidnumber=[fuzzy_digits],
                     mail=[u'te...@example.com', u'te...@example.com'],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -113,7 +113,7 @@ class test_replace(Declarative):
                     gidnumber=[fuzzy_digits],
                     mail=[u'te...@example.com'],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -137,7 +137,7 @@ class test_replace(Declarative):
                     gidnumber=[fuzzy_digits],
                     mail=[u'te...@example.com', u'te...@example.com', u'te...@example.com'],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -160,7 +160,7 @@ class test_replace(Declarative):
                     uidnumber=[fuzzy_digits],
                     gidnumber=[fuzzy_digits],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -184,7 +184,7 @@ class test_replace(Declarative):
                     gidnumber=[fuzzy_digits],
                     initials=[u'ABC'],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -207,7 +207,7 @@ class test_replace(Declarative):
                     uidnumber=[fuzzy_digits],
                     gidnumber=[fuzzy_digits],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py
index 9ebf844d5b7bb9ba4d60e4faf5801f561fa6509d..8c3ddf4263cdd6ccb8a9c9998b3864d1c900eb39 100644
--- a/tests/test_xmlrpc/test_user_plugin.py
+++ b/tests/test_xmlrpc/test_user_plugin.py
@@ -129,7 +129,7 @@ class test_user(Declarative):
                     uidnumber=[fuzzy_digits],
                     gidnumber=[fuzzy_digits],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 value=user1,
                 summary=None,
@@ -161,7 +161,7 @@ class test_user(Declarative):
                         'ipauniqueid': [fuzzy_uuid],
                         'mepmanagedentry': [u'cn=%s,cn=groups,cn=accounts,%s' % (user1, api.env.basedn)],
                         'krbpwdpolicyreference': [u'cn=global_policy,cn=%s,cn=kerberos,%s' % (api.env.realm, api.env.basedn)],
-                        'nsaccountlock': [u'False'],
+                        'nsaccountlock': [u'FALSE'],
                         'displayname': [u'Test User1'],
                         'cn': [u'Test User1'],
                         'initials': [u'TU'],
@@ -187,7 +187,7 @@ class test_user(Declarative):
                         loginshell=[u'/bin/sh'],
                         sn=[u'User1'],
                         uid=[user1],
-                        nsaccountlock=[u'False'],
+                        nsaccountlock=[u'FALSE'],
                         uidnumber=[fuzzy_digits],
                         gidnumber=[fuzzy_digits],
                     ),
@@ -212,7 +212,7 @@ class test_user(Declarative):
                         loginshell=[u'/bin/bash'],
                         sn=[u'Administrator'],
                         uid=[u'admin'],
-                        nsaccountlock=[u'False'],
+                        nsaccountlock=[u'FALSE'],
                         uidnumber=[fuzzy_digits],
                         gidnumber=[fuzzy_digits],
                     ),
@@ -223,7 +223,7 @@ class test_user(Declarative):
                         loginshell=[u'/bin/sh'],
                         sn=[u'User1'],
                         uid=[user1],
-                        nsaccountlock=[u'False'],
+                        nsaccountlock=[u'FALSE'],
                         uidnumber=[fuzzy_digits],
                         gidnumber=[fuzzy_digits],
                     ),
@@ -248,7 +248,7 @@ class test_user(Declarative):
                         loginshell=[u'/bin/bash'],
                         sn=[u'Administrator'],
                         uid=[u'admin'],
-                        nsaccountlock=[u'False'],
+                        nsaccountlock=[u'FALSE'],
                         uidnumber=[fuzzy_digits],
                         gidnumber=[fuzzy_digits],
                     ),
@@ -301,7 +301,7 @@ class test_user(Declarative):
                     uidnumber=[fuzzy_digits],
                     gidnumber=[fuzzy_digits],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "tuser1"',
                 value=user1,
@@ -332,7 +332,7 @@ class test_user(Declarative):
                     uidnumber=[fuzzy_digits],
                     gidnumber=[fuzzy_digits],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=None,
                 value=user1,
@@ -354,7 +354,7 @@ class test_user(Declarative):
                     uidnumber=[fuzzy_digits],
                     gidnumber=[fuzzy_digits],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "%s"' % user1,
                 value=user1,
@@ -382,7 +382,7 @@ class test_user(Declarative):
                     uidnumber=[fuzzy_digits],
                     gidnumber=[fuzzy_digits],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                 ),
                 summary=u'Modified user "%s"' % renameduser1,
                 value=renameduser1,
@@ -497,7 +497,7 @@ class test_user(Declarative):
                     uidnumber=[fuzzy_digits],
                     gidnumber=[fuzzy_digits],
                     memberof_group=[u'ipausers'],
-                    nsaccountlock=[u'False'],
+                    nsaccountlock=[u'FALSE'],
                     manager=[user1],
                 ),
                 summary=u'Modified user "%s"' % user2,
-- 
1.7.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to