From 60b8ac79d6dc15d84cc0d64b6e62006b41880c59 Mon Sep 17 00:00:00 2001
From: el_kaboing <el_kaboing@localhost>
Date: Wed, 03 Jan 2007 15:06:06 +0000
Subject: [PATCH] Added test cases for Issue 575.

---
 opends/tests/functional-tests/shared/data/security/pwd_policy/user_add_attr.ldif          |   29 +++++++++
 opends/tests/functional-tests/shared/data/security/pwd_policy/user_del_attr.ldif          |   28 +++++++++
 opends/tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change.xml |  123 ++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 177 insertions(+), 3 deletions(-)

diff --git a/opends/tests/functional-tests/shared/data/security/pwd_policy/user_add_attr.ldif b/opends/tests/functional-tests/shared/data/security/pwd_policy/user_add_attr.ldif
new file mode 100644
index 0000000..1accb63
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/pwd_policy/user_add_attr.ldif
@@ -0,0 +1,29 @@
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE
+# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+# add the following below this CDDL HEADER, with the fields enclosed
+# by brackets "[]" replaced with your own identifying * information:
+#      Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#      Portions Copyright 2006 Sun Microsystems, Inc.
+#
+
+dn: uid=mdog,ou=People,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com
+changetype: modify
+add: pager
+pager: +1 999 555 1212
diff --git a/opends/tests/functional-tests/shared/data/security/pwd_policy/user_del_attr.ldif b/opends/tests/functional-tests/shared/data/security/pwd_policy/user_del_attr.ldif
new file mode 100644
index 0000000..ab1e226
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/pwd_policy/user_del_attr.ldif
@@ -0,0 +1,28 @@
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE
+# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+# add the following below this CDDL HEADER, with the fields enclosed
+# by brackets "[]" replaced with your own identifying * information:
+#      Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#      Portions Copyright 2006 Sun Microsystems, Inc.
+#
+
+dn: uid=mdog,ou=People,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com
+changetype: modify
+delete: roomnumber
diff --git a/opends/tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change.xml b/opends/tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change.xml
index 57afb74..e6dda14 100755
--- a/opends/tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change.xml
+++ b/opends/tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change.xml
@@ -262,10 +262,17 @@
                 'entryToBeModified'   : '%s/security/pwd_policy/admin_change_user_pwd.ldif' % STAGED_DATA_DIR }
             </call>
 
-            <if expr="RC != 0">
-                <tcstatus result="'fail'"/>
-            </if>
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult  }
+            </call>
+          </sequence>
+        </testcase>
 
+
+        <!--- Test Case : User Search With Old Pwd -->
+        <testcase name="'Security: Pwd Change: Old Pwd - Search'">
+          <sequence>
             <message>
                'Security: Pwd Change: User Searching With Old Password'
             </message>
@@ -280,11 +287,121 @@
                 'extraParams'      : '-s base' }
             </call>
 
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 1  }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Add With Old Pwd -->
+        <testcase name="'Security: Pwd Change: Old Pwd - Add'">
+          <sequence>
+            <message>
+               'Security: Pwd Change: User Adding Attr With Old Password'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : 'uid=mdog,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                'dsInstancePswd'   : 'pizza' ,
+                'entryToBeModified'   : '%s/security/pwd_policy/user_add_attr.ldif' % STAGED_DATA_DIR }
+            </call>
+
             <if expr="RC != 1">
                 <tcstatus result="'fail'"/>
             </if>
 
             <message>
+               'Security: Pwd Change: Checking For Existence of User-added Attribute'
+            </message>
+
+            <call function="'compareEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'attrToBeCompared'   : 'pager:+1 999 555-1212',
+                'entryToBeCompared'   : 'uid=mdog,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 16  }
+            </call>
+          </sequence>
+        </testcase>
+
+     <!--- Test Case : User Delete With Old Pwd -->
+        <testcase name="'Security: Pwd Change: Old Pwd - Delete'">
+          <sequence>
+            <message>
+               'Security: Pwd Change: User Deleting Attr With Old Password'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : 'uid=mdog,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                'dsInstancePswd'   : 'pizza' ,
+                'entryToBeModified'   : '%s/security/pwd_policy/user_del_attr.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <if expr="RC != 1">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: Pwd Change: Checking For Existence of User-deleted Attribute'
+            </message>
+
+            <call function="'compareEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'attrToBeCompared'   : 'roomnumber:4612',
+                'entryToBeCompared'   : 'uid=mdog,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+          </sequence>
+        </testcase>
+
+     <!--- Test Case : User Delete With Old Pwd -->
+        <testcase name="'Security: Pwd Change: Old Pwd - Compare'">
+          <sequence>
+            <message>
+               'Security: Pwd Change: Checking For Existence of User Attribute'
+            </message>
+
+            <call function="'compareEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : 'uid=mdog,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                'dsInstancePswd'   : 'pizza' ,
+                'attrToBeCompared'   : 'l:Sunnyvale',
+                'entryToBeCompared'   : 'uid=mdog,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 1  }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Search With Assigned Pwd -->
+        <testcase name="'Security: Pwd Change: Search With Assigned Pwd'">
+          <sequence>
+            <message>
                'Security: Pwd Change: User Searching With Assigned Password'
             </message>
 

--
Gitblit v1.10.0