[Checkins] SVN: zope.app.http/trunk/src/zope/app/http/tests/test_ - moved test_functional_put.py to zope.app.file

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


Log message for revision 116497:
  - moved test_functional_put.py to zope.app.file
  - changed test to get same coverage as before
  

Changed:
  D   zope.app.http/trunk/src/zope/app/http/tests/test_functional_put.py
  U   zope.app.http/trunk/src/zope/app/http/tests/test_put.py

-=-
Deleted: zope.app.http/trunk/src/zope/app/http/tests/test_functional_put.py
===================================================================
--- zope.app.http/trunk/src/zope/app/http/tests/test_functional_put.py	2010-09-17 12:00:35 UTC (rev 116496)
+++ zope.app.http/trunk/src/zope/app/http/tests/test_functional_put.py	2010-09-17 12:04:44 UTC (rev 116497)
@@ -1,63 +0,0 @@
-##############################################################################
-#
-# 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.http)
-
-    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),
-        ))

Modified: zope.app.http/trunk/src/zope/app/http/tests/test_put.py
===================================================================
--- zope.app.http/trunk/src/zope/app/http/tests/test_put.py	2010-09-17 12:00:35 UTC (rev 116496)
+++ zope.app.http/trunk/src/zope/app/http/tests/test_put.py	2010-09-17 12:04:44 UTC (rev 116497)
@@ -47,7 +47,7 @@
 
     __name__ = None
     __parent__ = None
-    
+
     def __init__(self, path):
         self.path = path
 
@@ -66,7 +66,7 @@
 class TestNullPUT(TestCase):
 
     layer = BrowserLayer(zope.app.http)
-    
+
     def test(self):
         self.rootFolder = rootFolder()
 
@@ -77,21 +77,21 @@
                               {'CONTENT_TYPE': 'test/foo',
                                'CONTENT_LENGTH': str(len(content)),
                                })
-        null = zope.app.http.put.NullResource(container, 'spam')
+        null = zope.app.http.put.NullResource(container, 'spam.txt')
         put = zope.app.http.put.NullPUT(null, request)
         self.assertEqual(getattr(container, 'spam', None), None)
         self.assertEqual(put.PUT(), '')
         request.response.setResult('')
-        file = container.spam
+        file = getattr(container, 'spam.txt')
         self.assertEqual(file.__class__, File)
-        self.assertEqual(file.name, 'spam')
+        self.assertEqual(file.name, 'spam.txt')
         self.assertEqual(file.content_type, 'test/foo')
         self.assertEqual(file.data, content)
 
         # Check HTTP Response
         self.assertEqual(request.response.getStatus(), 201)
         self.assertEqual(request.response.getHeader("Location"),
-                         "http://127.0.0.1/put/spam")
+                         "http://127.0.0.1/put/spam.txt")
 
     def test_bad_content_header(self):
         ## The previous behavour of the PUT method was to fail if the request



More information about the checkins mailing list