[Zope3-checkins] CVS: Zope3/src/zope/app/dav/tests - test_propfind.py:1.23

Fred L. Drake, Jr. fred at zope.com
Thu May 6 11:42:34 EDT 2004


Update of /cvs-repository/Zope3/src/zope/app/dav/tests
In directory cvs.zope.org:/tmp/cvs-serv3645

Modified Files:
	test_propfind.py 
Log Message:
- _createRequest(): convert "-" in headers to "_" in the environment;
  not doing this caused input information not to be picked up since
  the names in the environment weren't right.  In particular, the
  Content-Type header wasn't getting passed as CONTENT_TYPE, but as
  CONTENT-TYPE, which no one looks at.
- test_bad_contenttype(): RFC 2518 says this should generally be a 400
  response (though we should probably deal with these things more
  flexibly than these tests currently do; a 207 *could* encapsulate a
  single 400)
- test_contenttype3(): New test that checks for proper behavior for a
  Content-Type with parameters and non-lowercase major/minor value
(closes Zope3 collection bug #206)


=== Zope3/src/zope/app/dav/tests/test_propfind.py 1.22 => 1.23 ===
--- Zope3/src/zope/app/dav/tests/test_propfind.py:1.22	Mon Mar 15 15:42:05 2004
+++ Zope3/src/zope/app/dav/tests/test_propfind.py	Thu May  6 11:42:34 2004
@@ -107,7 +107,7 @@
 
     if headers is not None:
         for key, value in headers.items():
-            _environ[key.upper()] = value
+            _environ[key.upper().replace("-", "_")] = value
 
     if skip_headers is not None:
         for key in skip_headers:
@@ -168,6 +168,18 @@
         # Check HTTP Response
         self.assertEqual(request.response.getStatus(), 207)
 
+    def test_contenttype3(self):
+        # Check for an appropriate response when the content-type has
+        # parameters, and that the major/minor parts are treated in a
+        # case-insensitive way.
+        file = self.file
+        request = _createRequest(headers={'Content-type':
+                                          'TEXT/XML; charset="utf-8"'})
+        pfind = propfind.PROPFIND(file, request)
+        pfind.PROPFIND()
+        # Check HTTP Response
+        self.assertEqual(request.response.getStatus(), 207)
+
     def test_bad_contenttype(self):
         file = self.file
         request = _createRequest(headers={'Content-type':'text/foo'})
@@ -175,7 +187,7 @@
         pfind = propfind.PROPFIND(file, request)
         pfind.PROPFIND()
         # Check HTTP Response
-        self.assertEqual(request.response.getStatus(), 207)
+        self.assertEqual(request.response.getStatus(), 400)
 
     def test_no_contenttype(self):
         file = self.file




More information about the Zope3-Checkins mailing list