clu_encode-password_checkbehavior.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, exclude this CDDL HEADER in each
! file and exclude 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 2008 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="clu_encode-password_checkbehavior"/>
<function name="clu_encode-password_checkbehavior">
<sequence>
<block name="'clu_encode-password_checkbehavior'">
<sequence>
<!--- Test Suite information
#@TestSuiteName encode-password check behavior tests
#@TestSuitePurpose Test the results of the encode-password command.
#@TestSuiteGroup encode-password check behavior tests
#@TestScript clu_encode-password_checkbehavior.xml
-->
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group'] = 'clu'
CurrentTestPath['suite'] = STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<!--- Define default value for clearFile and encodedFile -->
<script>
clearFile = '%s/clu/clear_password.ref' % remote.data
encodedFile = '%s/clu/encoded_password.ref' % remote.data
</script>
<!--- Test Case information
#@TestMarker encode-password check behavior tests
#@TestName encode-password: list available schemes
#@TestIssue none
#@TestPurpose Test encode-password with listSchemes option.
#@TestPreamble none
#@TestStep Do an encode-password with listSchemes option.
#@TestPostamble none
#@TestResult Success if encode-password returns 0.
-->
<testcase name="getTestCaseName
('encode-password: list available schemes')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'encode-password: list available schemes'
</message>
<call function="'encodePasswordWithScript'">
{
'listSchemes' : 'True'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : 'SSHA'
}
</call>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : 'MD5'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker encode-password check behavior tests
#@TestName encode-password: list available
authPasswordSyntax schemes
#@TestIssue none
#@TestPurpose Test encode-password with listSchemes and
authPasswordSyntax options.
#@TestPreamble none
#@TestStep Do an encode-password with listSchemes and
authPasswordSyntax options.
#@TestPostamble none
#@TestResult Success if encode-password returns 0.
-->
<testcase name="getTestCaseName
('encode-password: list available authPasswordSyntax schemes')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'encode-password: list available authPasswordSyntax schemes'
</message>
<call function="'encodePasswordWithScript'">
{
'listSchemes' : 'True' ,
'authPwdSyntax' : 'True'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : 'SHA1'
}
</call>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : 'MD5'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker encode-password check behavior tests
#@TestName encode-password: encode clear-text pwd
#@TestIssue none
#@TestPurpose Test encode-password to encode clear-text pwd.
#@TestPreamble none
#@TestStep Do an encode-password to encode clear-text pwd
#@TestStep Remove schemes tag from pwd for next testcases
#@TestPostamble none
#@TestResult Success if encode-password returns 0.
-->
<testcase name="getTestCaseName
('encode-password: encode clear-text pwd')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'encode-password: encode clear-text pwd'
</message>
<call function="'encodePasswordWithScript'">
{
'clearPwd' : 'mypassword' ,
'storageScheme' : 'SSHA'
}
</call>
<script>
returnString = STAXResult[0][1]
cmdResult = returnString.split(':')
pwd = cmdResult[1].strip().replace('{SSHA}', '')
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : 'Encoded Password:'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker encode-password check behavior tests
#@TestName encode-password: encode clear-text pwd using
authPasswordSyntax
#@TestIssue none
#@TestPurpose Test encode-password to encode clear-text pwd
using authPasswordSyntax.
#@TestPreamble none
#@TestStep Do an encode-password to encode clear-text
with -a option.
#@TestPostamble none
#@TestResult Success if encode-password returns 0.
-->
<testcase name="getTestCaseName
('encode-password: encode clear-text pwd using authPasswordSyntax')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'encode-password: encode clear-text pwd using \
authPasswordSyntax'
</message>
<call function="'encodePasswordWithScript'">
{
'clearPwd' : 'mypassword' ,
'storageScheme' : 'SHA1' ,
'authPwdSyntax' : 'True'
}
</call>
<script>
returnString = STAXResult[0][1]
cmdResult = returnString.split(':')
pwd2 = cmdResult[1].strip().replace('"', '')
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : 'Encoded Password:'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker encode-password check behavior tests
#@TestName encode-password: compare pwds
#@TestIssue none
#@TestPurpose Test encode-password to compare pwds.
#@TestPreamble none
#@TestStep Do an encode-password to compare pwds without
storageScheme option
#@TestStep Do an encode-password to compare good pwds with
storageSchema option
#@TestStep Do an encode-password to compare bad pws with
storageSchema option
#@TestPostamble none
#@TestResult Success if encode-password returns 1 for the
fisrt test and 0 otherwise, and if the outputs
are corrects.
-->
<testcase name="getTestCaseName
('encode-password: compare pwd')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'encode-password: comparison error'
</message>
<call function="'encodePasswordWithScript'">
{
'clearPwd' : 'mypassword' ,
'encodedPwd' : pwd ,
'expectedRC' : 1
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : 'No password storage scheme was specified'
}
</call>
<message>
'encode-password: comparison successful'
</message>
<call function="'encodePasswordWithScript'">
{
'clearPwd' : 'mypassword' ,
'encodedPwd' : pwd ,
'storageScheme' : 'SSHA'
}
</call>
<script>
returnString = STAXResult[0][1]
msg = 'The provided clear-text and encoded passwords match'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<message>
'encode-password: comparison unsuccessful'
</message>
<call function="'encodePasswordWithScript'">
{
'clearPwd' : 'password' ,
'encodedPwd' : pwd ,
'storageScheme' : 'SSHA'
}
</call>
<script>
returnString = STAXResult[0][1]
msg='The provided clear-text and encoded passwords do not match'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker encode-password check behavior tests
#@TestName encode-password: compare pwds encoded with
-a option
#@TestIssue none
#@TestPurpose Test encode-password to compare pwds encoded
with -a option.
#@TestPreamble none
#@TestStep Do an encode-password to compare pwds without
-a option and with -r option
#@TestStep Do an encode-password to compare good pwds with
-a and -r options
#@TestStep Do an encode-password to compare bad pws with
-a and -r options
#@TestPostamble none
#@TestResult Success if encode-password returns 1 for the
fisrt test, 6 when the comparison is successful,
5 when the comparison is unsuccessful, and if the
outputs are corrects.
-->
<testcase name="getTestCaseName
('encode-password: compare pwd with -r option')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'encode-password: comparison error'
</message>
<call function="'encodePasswordWithScript'">
{
'clearPwd' : 'mypassword' ,
'encodedPwd' : pwd2 ,
'useCmpRC' : 'True' ,
'expectedRC' : 1
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : 'No password storage scheme was specified'
}
</call>
<message>
'encode-password: comparison successful'
</message>
<call function="'encodePasswordWithScript'">
{
'clearPwd' : 'mypassword' ,
'encodedPwd' : pwd2 ,
'authPwdSyntax' : 'True' ,
'useCmpRC' : 'True' ,
'expectedRC' : 6
}
</call>
<script>
returnString = STAXResult[0][1]
msg = 'The provided clear-text and encoded passwords match'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<message>
'encode-password: comparison unsuccessful'
</message>
<call function="'encodePasswordWithScript'">
{
'clearPwd' : 'password' ,
'encodedPwd' : pwd2 ,
'authPwdSyntax' : 'True' ,
'useCmpRC' : 'True' ,
'expectedRC' : 5
}
</call>
<script>
returnString = STAXResult[0][1]
msg='The provided clear-text and encoded passwords do not match'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker encode-password check behavior tests
#@TestName encode-password: compare pwds using files
#@TestIssue none
#@TestPurpose Test encode-password to compare password using
files.
#@TestPreamble none
#@TestStep Do an encode-password to compare good pwds
stored in files and using -r option.
#@TestPostamble none
#@TestResult Success if encode-password returns 6 and the
output is correct.
-->
<testcase name="getTestCaseName
('encode-password: compare pwd using file')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'encode-password: comparison successful'
</message>
<call function="'encodePasswordWithScript'">
{
'clearPwdFile' : clearFile ,
'encodedPwdFile' : encodedFile ,
'useCmpRC' : 'True' ,
'expectedRC' : 6
}
</call>
<script>
returnString = STAXResult[0][1]
msg = 'The provided clear-text and encoded passwords match'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<call function="'testSuite_Postamble'"/>
</sequence>
</block>
</sequence>
</function>
</stax>