[Checkins] SVN: z3c.dav/trunk/src/z3c/dav/ftests/ Add tests to make sure that the correct properties are defined on a folder.

Michael Kerrin michael.kerrin at openapp.ie
Mon Feb 11 14:55:59 EST 2008


Log message for revision 83751:
  Add tests to make sure that the correct properties are defined on a folder.
  

Changed:
  A   z3c.dav/trunk/src/z3c/dav/ftests/test_docs.py
  A   z3c.dav/trunk/src/z3c/dav/ftests/zopefolder.txt

-=-
Added: z3c.dav/trunk/src/z3c/dav/ftests/test_docs.py
===================================================================
--- z3c.dav/trunk/src/z3c/dav/ftests/test_docs.py	                        (rev 0)
+++ z3c.dav/trunk/src/z3c/dav/ftests/test_docs.py	2008-02-11 19:55:57 UTC (rev 83751)
@@ -0,0 +1,37 @@
+##############################################################################
+#
+# Copyright (c) 2008 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import os.path
+import unittest
+from zope.testing import doctest
+
+import z3c.etree.testing
+import z3c.dav.testing
+
+here = os.path.dirname(os.path.realpath(z3c.dav.testing.__file__))
+ZopeFolderDAVLayer = z3c.dav.testing.WebDAVLayerClass(
+    os.path.join(here, "ftesting.zcml"), __name__, "ZopeFolderDAVLayer")
+
+def test_suite():
+    properties = doctest.DocFileSuite(
+        "zopefolder.txt",
+        setUp = z3c.dav.testing.functionalSetUp,
+        tearDown = z3c.dav.testing.functionalTearDown,
+        checker = z3c.etree.testing.xmlOutputChecker,
+        )
+    properties.layer = ZopeFolderDAVLayer
+
+    return unittest.TestSuite((
+        properties,
+        ))

Added: z3c.dav/trunk/src/z3c/dav/ftests/zopefolder.txt
===================================================================
--- z3c.dav/trunk/src/z3c/dav/ftests/zopefolder.txt	                        (rev 0)
+++ z3c.dav/trunk/src/z3c/dav/ftests/zopefolder.txt	2008-02-11 19:55:57 UTC (rev 83751)
@@ -0,0 +1,101 @@
+===========================
+zope.app.folder integration
+===========================
+
+  >>> import z3c.etree
+  >>> from zope.app.folder.folder import Folder
+
+  >>> resp = http("""
+  ... PROPFIND / HTTP/1.1
+  ... """, handle_errors = True)
+  >>> resp.getStatus()
+  207
+  >>> resp.getHeader('content-type')
+  'application/xml'
+  >>> print resp.getBody() #doctest:+XMLDATA,+ELLIPSIS
+  <multistatus xmlns="DAV:">
+    <response>
+      <href>http://localhost/</href>
+      <propstat>
+        <prop>
+          <creationdate>...</creationdate>
+          <displayname />
+          <getlastmodified>...</getlastmodified>
+          <resourcetype><collection /></resourcetype>
+        </prop>
+        <status>HTTP/1.1 200 Ok</status>
+      </propstat>
+    </response>
+    <response>
+      <href>http://localhost/++etc++site/</href>
+      <propstat>
+        <prop>
+          <resourcetype><collection /></resourcetype>
+        </prop>
+        <status>HTTP/1.1 200 Ok</status>
+      </propstat>
+    </response>
+  </multistatus>
+
+When we are logged in we get more information on the '++etc++site' folder since
+we are allowed to list the folder contents here.
+
+  >>> resp = http("""
+  ... PROPFIND / HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... """, handle_errors = True)
+  >>> resp.getStatus()
+  207
+  >>> resp.getHeader('content-type')
+  'application/xml'
+  >>> print resp.getBody() #doctest:+XMLDATA,+ELLIPSIS
+  <multistatus xmlns="DAV:">
+    <response>
+      <href>http://localhost/</href>
+      <propstat>
+        <prop>
+          <creationdate>...</creationdate>
+          <displayname />
+          <getlastmodified>...</getlastmodified>
+          <resourcetype><collection /></resourcetype>
+        </prop>
+        <status>HTTP/1.1 200 Ok</status>
+      </propstat>
+    </response>
+    <response>
+      <href>http://localhost/++etc++site/</href>
+      <propstat>
+        <prop>
+          <resourcetype><collection /></resourcetype>
+        </prop>
+        <status>HTTP/1.1 200 Ok</status>
+      </propstat>
+    </response>
+    <response>
+      <href>http://localhost/++etc++site/default/</href>
+      <propstat>
+        <prop>
+          <resourcetype><collection /></resourcetype>
+        </prop>
+        <status>HTTP/1.1 200 Ok</status>
+      </propstat>
+    </response>
+    <response>
+      <href>http://localhost/++etc++site/default/PrincipalAnnotation</href>
+      <propstat>
+        <prop>
+          <resourcetype />
+        </prop>
+        <status>HTTP/1.1 200 Ok</status>
+      </propstat>
+    </response>
+    <response>
+      <href>http://localhost/++etc++site/default/RootErrorReportingUtility</href>
+      <propstat>
+        <prop>
+          <resourcetype />
+        </prop>
+        <status>HTTP/1.1 200 Ok</status>
+      </propstat>
+    </response>
+  </multistatus>


Property changes on: z3c.dav/trunk/src/z3c/dav/ftests/zopefolder.txt
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list