From 39f05a47aa7a7ee5ccf1539bd3f38c8bd18673f1 Mon Sep 17 00:00:00 2001
From: el_kaboing <el_kaboing@localhost>
Date: Thu, 30 Nov 2006 15:18:35 +0000
Subject: [PATCH] Allows the testing of strings in the functional tests.
---
opends/tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change_all_users.xml | 10 +++++++---
opends/tests/functional-tests/shared/functions/utils.xml | 42 ++++++++++++++++++++++++++++++++++++++++++
opends/tests/functional-tests/shared/functions/ldap.xml | 2 ++
3 files changed, 51 insertions(+), 3 deletions(-)
diff --git a/opends/tests/functional-tests/shared/functions/ldap.xml b/opends/tests/functional-tests/shared/functions/ldap.xml
index 3c9a3c6..ca830a4 100755
--- a/opends/tests/functional-tests/shared/functions/ldap.xml
+++ b/opends/tests/functional-tests/shared/functions/ldap.xml
@@ -180,6 +180,8 @@
<stderr mode="'stdout'"/>
<returnstdout/>
</process>
+
+ <return>STAXResult</return>
</sequence>
diff --git a/opends/tests/functional-tests/shared/functions/utils.xml b/opends/tests/functional-tests/shared/functions/utils.xml
index 39f14ed..b924840 100755
--- a/opends/tests/functional-tests/shared/functions/utils.xml
+++ b/opends/tests/functional-tests/shared/functions/utils.xml
@@ -119,6 +119,48 @@
</function>
+ <function name="checktestString">
+
+ <function-prolog>
+ This function checks the return string against an expected return substring for a testcase
+ </function-prolog>
+
+ <function-map-args>
+ <function-required-arg name="expectedString">
+ the substring expected from the command
+ </function-required-arg>
+ <function-required-arg name="returnString">
+ the return string received from command
+ </function-required-arg>
+
+ </function-map-args>
+
+ <sequence>
+ <script>
+ import re
+ searchre = re.compile('%s' % expectedString)
+ </script>
+
+ <if expr='re.search(searchre, returnString) != None'>
+ <sequence>
+ <tcstatus result="'pass'"/>
+ <message log="1">
+ 'Success: Found substring, %s, in the return string' % (expectedString)
+ </message>
+ </sequence>
+ <else>
+ <sequence>
+ <tcstatus result="'fail'"/>
+ <message log="1" level="'Error'">
+ 'Error: Did not find substring, %s, in the return string, %s' % (expectedString, returnString)
+ </message>
+ </sequence>
+ </else>
+ </if>
+ </sequence>
+
+ </function>
+
<function name="isAlive">
<function-prolog>
diff --git a/opends/tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change_all_users.xml b/opends/tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change_all_users.xml
index 870eb52..4573ca8 100755
--- a/opends/tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change_all_users.xml
+++ b/opends/tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change_all_users.xml
@@ -166,9 +166,13 @@
'extraParams' : '-s base' }
</call>
- <call function="'checktestRC'">
- { 'returncode' : RC ,
- 'result' : STAXResult }
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ { 'returnString' : returnString ,
+ 'expectedString' : 'will expire' }
</call>
</sequence>
</testcase>
--
Gitblit v1.10.0