core_ctrls_authorization_id.xml revision d81978a0815d5b8a75633c35e3e1f8708d36f017
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "/shared/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
!
! Copyright 2007-2008 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="core_ctrls_authorization_id"/>
<function name="core_ctrls_authorization_id">
<sequence>
<block name="'ctrls_authorization_id'">
<sequence>
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group']='core'
CurrentTestPath['suite']=STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/core/core_setup.xml' % (TESTS_DIR)" />
<call function="'core_setup'" />
<!--- Test Suite information
#@TestSuiteName Core Controls authorization id
#@TestSuitePurpose Verify that the controls functionality is
working in the Directory Server.
#@TestSuiteGroup core: Controls: authorization id
#@TestScript core_ctrls_authorization_id.xml
-->
<!-- Global variables -->
<script>
peopleDn = 'ou=North America,o=core tests,dc=example,dc=com'
</script>
<!--- Test Case information
#@TestMarker Core Controls authorization id Tests
#@TestName Search with directory manager user
#@TestPurpose Check reportAuthzID option with dir manager
#@TestPreamble
#@TestSteps Do a search and check the outputs
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Search with Directory Manager')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'uid=user.1,%s' % peopleDn ,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '--reportAuthzID'
}
</call>
<!-- ========== -->
<script>
string1 = '# Bound with authorization ID dn:'
string2 = 'cn=Directory Manager,cn=Root DNs,cn=config'
string2find = '%s%s' % (string1, string2)
</script>
<call function="'CheckMatches'">
{
'string2find' : string2find ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1 ,
'caseSensitive' : False
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Core Controls authorization id Tests
#@TestName Search with a user entry
#@TestPurpose Check reportAuthzID option with a user
#@TestPreamble
#@TestSteps Do a search and check the outputs
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Search with a user entry')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
userDn = 'uid=user.1,%s' % peopleDn
</script>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : userDn ,
'dsInstancePswd' : 'password' ,
'dsBaseDN' : userDn ,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '--reportAuthzID'
}
</call>
<!-- ========== -->
<script>
string1 = '# Bound with authorization ID dn:'
string2 = '%s' % userDn
string2find = '%s%s' % (string1, string2)
</script>
<call function="'CheckMatches'">
{
'string2find' : string2find ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Core Controls authorization id Tests
#@TestName Search with a bad baseDn
#@TestPurpose Check reportAuthzID option with bad baseDn
#@TestPreamble
#@TestSteps Do a search and check the outputs
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Search with a bad baseDn')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
userDn = 'uid=user.1,%s' % peopleDn
</script>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : userDn ,
'dsInstancePswd' : 'password' ,
'dsBaseDN' : 'uid=hello,%s' % peopleDn,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '--reportAuthzID' ,
'expectedRC' : 32
}
</call>
<!-- ========== -->
<script>
string1 = '# Bound with authorization ID dn:'
string2 = '%s' % userDn
string2find = '%s%s' % (string1, string2)
</script>
<call function="'CheckMatches'">
{
'string2find' : string2find ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/core/core_cleanup.xml' % (TESTS_DIR)" />
<call function="'core_cleanup'" />
<call function="'testSuite_Postamble'"/>
</sequence>
</block>
</sequence>
</function>
</stax>