[Zope3-checkins] SVN: Zope3/branches/3.3/src/zope/app/http/ftests/ backporting fix for issue 125 from trunk@70412

Wolfgang Schnerring wosc at wosc.de
Thu Sep 28 04:46:45 EDT 2006


Log message for revision 70415:
  backporting fix for issue 125 from trunk at 70412

Changed:
  A   Zope3/branches/3.3/src/zope/app/http/ftests/
  A   Zope3/branches/3.3/src/zope/app/http/ftests/__init__.py
  A   Zope3/branches/3.3/src/zope/app/http/ftests/test_put.py

-=-
Added: Zope3/branches/3.3/src/zope/app/http/ftests/__init__.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/http/ftests/__init__.py	2006-09-28 08:46:29 UTC (rev 70414)
+++ Zope3/branches/3.3/src/zope/app/http/ftests/__init__.py	2006-09-28 08:46:45 UTC (rev 70415)
@@ -0,0 +1 @@
+# python package

Added: Zope3/branches/3.3/src/zope/app/http/ftests/test_put.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/http/ftests/test_put.py	2006-09-28 08:46:29 UTC (rev 70414)
+++ Zope3/branches/3.3/src/zope/app/http/ftests/test_put.py	2006-09-28 08:46:45 UTC (rev 70415)
@@ -0,0 +1,58 @@
+##############################################################################
+#
+# 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: test_put.py 67630 2006-04-27 00:54:03Z jim $
+"""
+
+from unittest import TestSuite, makeSuite
+
+from zope.app.testing.functional import FunctionalTestCase, HTTPCaller
+
+class TestPUT(FunctionalTestCase):
+    def test_put(self):
+        # PUT something for the first time
+        response = HTTPCaller()(r"""PUT /testfile.txt HTTP/1.1
+Authorization: Basic bWdyOm1ncnB3
+Content-Length: 20
+Content-Type: text/plain
+
+This is just a test.""")
+        self.assertEquals(response._response.getStatus(), 201)
+        self.assertEquals(response._response.getHeader("Location"),
+                          "http://localhost/testfile.txt")
+
+        response = HTTPCaller()(r"""GET /testfile.txt HTTP/1.1
+Authorization: Basic bWdyOm1ncnB3""")
+        self.assertEquals(response.getBody(), "This is just a test.")
+
+        # now modify it
+        response = HTTPCaller()(r"""PUT /testfile.txt HTTP/1.1
+Authorization: Basic bWdyOm1ncnB3
+Content-Length: 22
+Content-Type: text/plain
+
+And now it is modified.""")
+        self.assertEquals(response._response.getStatus(), 200)
+        self.assertEquals(response.getBody(), "")
+
+        response = HTTPCaller()(r"""GET /testfile.txt HTTP/1.1
+Authorization: Basic bWdyOm1ncnB3""")
+        self.assertEquals(response.getBody(), "And now it is modified.")
+        
+        
+def test_suite():
+    return TestSuite((
+        makeSuite(TestPUT),
+        ))



More information about the Zope3-Checkins mailing list