[Zope-CVS] CVS: Packages/FunctionalTests/examples - payload_test.py:1.2 simple_payload_test.zft:1.2

Tres Seaver tseaver@zope.com
Fri, 13 Jun 2003 23:56:52 -0400


Update of /cvs-repository/Packages/FunctionalTests/examples
In directory cvs.zope.org:/tmp/cvs-serv7180/examples

Modified Files:
	payload_test.py simple_payload_test.zft 
Log Message:
 - Add sketch of XPath-based validation.

=== Packages/FunctionalTests/examples/payload_test.py 1.1 => 1.2 ===
--- Packages/FunctionalTests/examples/payload_test.py:1.1	Fri Jun 13 23:22:56 2003
+++ Packages/FunctionalTests/examples/payload_test.py	Fri Jun 13 23:56:51 2003
@@ -2,3 +2,22 @@
 
     if not payload.find( 'Welcome to Zope' ) >= 0:
         raise ValueError, 'Not www.zope.org'
+
+def _makeContext( payload ):
+
+    from xml.dom.ext.reader.HtmlLib import Reader
+    from xml.xpath.Context import Context
+
+    doc = Reader().fromString( payload )
+    return Context( doc, 1, 1 )
+
+
+def xpath_zope_org( request, payload ):
+
+    from xml.xpath import Evaluate
+
+    ctx = _makeContext( payload )
+
+    # TODO:  check payload using XPath expressions stored on the
+    #        invocation.
+


=== Packages/FunctionalTests/examples/simple_payload_test.zft 1.1 => 1.2 ===
--- Packages/FunctionalTests/examples/simple_payload_test.zft:1.1	Fri Jun 13 23:22:56 2003
+++ Packages/FunctionalTests/examples/simple_payload_test.zft	Fri Jun 13 23:56:51 2003
@@ -2,12 +2,20 @@
 Title : Demonstrate Payload Validation
 Use_case: Page Has Correct Content
 
-[Home_Page]
+[Zope_org_simple]
 URL: http://www.zope.org
 Expected_Result: 200
 Expected_Payload_Filename=%(config_dir)s/payload_test.py
 Expected_Payload_Function=is_zope_org
 Expected_Time: 30.0
+
+[Zope_org_xpath]
+URL: http://www.zope.org
+Expected_Result: 200
+Expected_Payload_Filename=%(config_dir)s/payload_test.py
+Expected_Payload_Function=xpath_zope_org
+Expected_Time: 30.0
+XPath_0 = //title/@value, Welcome to Zope.org
 
 [DEFAULT]
 userid: user