[Checkins] SVN: zope.app.file/trunk/ Moved a functional test here from `zope.app.http`.

Michael Howitz mh at gocept.com
Fri Sep 17 08:25:17 EDT 2010


Log message for revision 116504:
  Moved a functional test here from `zope.app.http`.
  
  

Changed:
  U   zope.app.file/trunk/CHANGES.txt
  A   zope.app.file/trunk/src/zope/app/file/tests/test_functional_put.py

-=-
Modified: zope.app.file/trunk/CHANGES.txt
===================================================================
--- zope.app.file/trunk/CHANGES.txt	2010-09-17 12:23:57 UTC (rev 116503)
+++ zope.app.file/trunk/CHANGES.txt	2010-09-17 12:25:17 UTC (rev 116504)
@@ -6,7 +6,9 @@
 
 - Removed ZPKG slugs and ZCML ones.
 
+- Moved a functional test here from `zope.app.http`.
 
+
 3.6.0 (2010-08-19)
 ------------------
 

Copied: zope.app.file/trunk/src/zope/app/file/tests/test_functional_put.py (from rev 116491, zope.app.http/trunk/src/zope/app/http/tests/test_functional_put.py)
===================================================================
--- zope.app.file/trunk/src/zope/app/file/tests/test_functional_put.py	                        (rev 0)
+++ zope.app.file/trunk/src/zope/app/file/tests/test_functional_put.py	2010-09-17 12:25:17 UTC (rev 116504)
@@ -0,0 +1,63 @@
+##############################################################################
+#
+# Copyright (c) 2003 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.
+#
+##############################################################################
+"""Test HTTP PUT verb
+
+$Id$
+"""
+
+from unittest import TestSuite, TestCase, makeSuite
+
+from zope.app.wsgi.testlayer import http, BrowserLayer
+import zope.app.http
+
+class TestPUT(TestCase):
+
+    layer = BrowserLayer(zope.app.file)
+
+    def test_put(self):
+        # PUT something for the first time
+        response = http(r"""PUT /testfile.txt HTTP/1.1
+Authorization: Basic globalmgr:globalmgrpw
+Content-Length: 20
+Content-Type: text/plain
+
+This is just a test.""")
+
+        self.assertEquals(response.getStatus(), 201)
+        self.assertEquals(response.getHeader("Location"),
+                          "http://localhost/testfile.txt")
+
+        response = http(r"""GET /testfile.txt HTTP/1.1
+Authorization: Basic globalmgr:globalmgrpw""")
+        self.assertEquals(response.getBody(), "This is just a test.")
+
+        # now modify it
+        response = http(r"""PUT /testfile.txt HTTP/1.1
+Authorization: Basic globalmgr:globalmgrpw
+Content-Length: 23
+Content-Type: text/plain
+
+And now it is modified.""")
+        self.assertEquals(response.getStatus(), 200)
+        self.assertEquals(response.getBody(), "")
+
+        response = http(r"""GET /testfile.txt HTTP/1.1
+Authorization: Basic globalmgr:globalmgrpw""")
+        self.assertEquals(response.getBody(), "And now it is modified.")
+
+
+def test_suite():
+    return TestSuite((
+        makeSuite(TestPUT),
+        ))



More information about the checkins mailing list