mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

el_kaboing
20.17.2006 3173bc27e85d1dbf26621bba19a95444d82a6e8c
Adding functional tests for Issue 320.
5 files added
1 files modified
352 ■■■■■ changed files
opends/tests/functional-tests/shared/data/security/pwd_policy/add_entry_preencoded_pwd.ldif 43 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/data/security/pwd_policy/add_entry_preencoded_pwd2.ldif 43 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/data/security/pwd_policy/admin_disable_preencoded_pwds.ldif 29 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/data/security/pwd_policy/admin_enable_preencoded_pwds.ldif 29 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/pwd_policy/security_preencoded_pwds.xml 204 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml 4 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/shared/data/security/pwd_policy/add_entry_preencoded_pwd.ldif
New file
@@ -0,0 +1,43 @@
# 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=pguy,ou=People,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com
objectClass: person
objectClass: inetOrgPerson
objectClass: top
objectClass: organizationalPerson
ou: Accounting
ou: People
sn: Guy
facsimiletelephonenumber: +1 408 555 9751
roomnumber: 4612
userpassword: {SSHA}oos/npB0lBtdF1hZxBlavB9m5c7Gczn+LOf41Q==
l: Sunnyvale
cn: Precoded Guy
telephonenumber: +1 408 555 4798
givenname: Precoded
uid: pguy
mail: pguy@example.com
opends/tests/functional-tests/shared/data/security/pwd_policy/add_entry_preencoded_pwd2.ldif
New file
@@ -0,0 +1,43 @@
# 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=pgal,ou=People,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com
objectClass: person
objectClass: inetOrgPerson
objectClass: top
objectClass: organizationalPerson
ou: Accounting
ou: People
sn: Gal
facsimiletelephonenumber: +1 408 555 9751
roomnumber: 4612
userpassword: {SSHA}h0RC6mR25hr6Kqe/j3Wsqt7KR6TkKTO/9LYTUQ==
l: Sunnyvale
cn: Precoded Gal
telephonenumber: +1 408 555 4798
givenname: Precoded
uid: pgal
mail: pguy@example.com
opends/tests/functional-tests/shared/data/security/pwd_policy/admin_disable_preencoded_pwds.ldif
New file
@@ -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: cn=Default Password Policy,cn=Password Policies,cn=config
changetype: modify
replace: ds-cfg-allow-pre-encoded-passwords
ds-cfg-allow-pre-encoded-passwords: false
opends/tests/functional-tests/shared/data/security/pwd_policy/admin_enable_preencoded_pwds.ldif
New file
@@ -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: cn=Default Password Policy,cn=Password Policies,cn=config
changetype: modify
replace: ds-cfg-allow-pre-encoded-passwords
ds-cfg-allow-pre-encoded-passwords: true
opends/tests/functional-tests/testcases/security/pwd_policy/security_preencoded_pwds.xml
New file
@@ -0,0 +1,204 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<!---
 * 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.
 -->
<stax>
  <defaultcall function="preencoded_pwds"/>
  <function name="preencoded_pwds">
      <sequence>
        <!--- Test Case : Preamble 1 - Check Default-->
        <testcase name="'Security: Preencoded Pwds: Preamble'">
          <sequence>
            <message>
               'Security: Preencoded Pwds: Preamble - Check for existence of ds-cfg-allow-pre-encoded-passwords'
            </message>
            <call function="'compareEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'attrToBeCompared'   : 'ds-cfg-allow-pre-encoded-passwords:false',
                'entryToBeCompared'   : 'cn=Default Password Policy,cn=Password Policies,cn=config' }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
            </call>
          </sequence>
        </testcase>
        <!--- Test Case : Add Entry With Pre-encoded Password -->
        <testcase name="'Security: Preencoded Pwds: Default - Add New Entry'">
          <sequence>
            <message>
               'Security: Preencoded Pwds: Adding New Entry With a Pre-encoded Password'
            </message>
            <call function="'addEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'entryToBeAdded'   : '%s/security/pwd_policy/add_entry_preencoded_pwd.ldif' % STAGED_DATA_DIR }
            </call>
            <if expr="RC != 19">
                <tcstatus result="'fail'"/>
            </if>
             <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=pguy,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'superguy' ,
                'dsBaseDN'   : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base' }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult ,
                  'expected'   : 1}
            </call>
          </sequence>
        </testcase>
        <!--- Test Case : Enable Pre-encoded Passwords -->
        <testcase name="'Security: Preencoded Pwds: Enable Preencoded Pwds'">
          <sequence>
            <message>
               'Security: Preencoded Pwds: Admin Enabling Preencoded Pwds'
            </message>
            <call function="'modifyEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'entryToBeModified'   : '%s/security/pwd_policy/admin_enable_preencoded_pwds.ldif' % STAGED_DATA_DIR }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
            </call>
          </sequence>
        </testcase>
        <!--- Test Case : Test Enabled Pre-encoded Passwords -->
        <testcase name="'Security: Preencoded Pwds: Enabled - Add New Entry'">
          <sequence>
            <message>
               'Security: Preencoded Pwds: Add New Entry With Pre-encoded Password'
            </message>
            <call function="'addEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'entryToBeAdded'   : '%s/security/pwd_policy/add_entry_preencoded_pwd.ldif' % STAGED_DATA_DIR }
            </call>
            <if expr="RC != 0">
                <tcstatus result="'fail'"/>
            </if>
             <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=pguy,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'superguy' ,
                'dsBaseDN'   : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base' }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
            </call>
          </sequence>
        </testcase>
        <!--- Test Case : Disable Pre-encoded Passwordds -->
        <testcase name="'Security: Preencoded Pwds: Disable Preencoded Pwds'">
          <sequence>
            <message>
               'Security: Preencoded Pwds: Admin Disabling Pre-encoded Pwds'
            </message>
            <call function="'modifyEntry'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'entryToBeModified'   : '%s/security/pwd_policy/admin_disable_preencoded_pwds.ldif' % STAGED_DATA_DIR }
            </call>
            <if expr="RC != 0">
                <tcstatus result="'fail'"/>
            </if>
             <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=pgal,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'supergal' ,
                'dsBaseDN'   : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base' }
            </call>
            <call function="'checktestRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult ,
                  'expected'   : 1}
            </call>
         </sequence>
        </testcase>
        <return>RC</return>
     </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml
@@ -111,6 +111,10 @@
          file="'%s/testcases/security/pwd_policy/security_mult_pwd_policies.xml' % (TESTS_DIR)"/>
        <call function="'mult_pwd_policies'" />
        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
          file="'%s/testcases/security/pwd_policy/security_preencoded_pwds.xml' % (TESTS_DIR)"/>
        <call function="'preencoded_pwds'" />
        <!--- Test Case : Stop DS -->
        <testcase name="'StopDS'">
          <sequence>