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

Sidnei da Silva sidnei@x3ng.com.br
Wed, 21 May 2003 16:29:47 -0400


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

Modified Files:
	test_propfind.py 
Log Message:
Default content type to text/xml. The RFC says nothing about it being required, and Nautilus doesnt send it. So, with this fix, I can browse Zope3 in Nautilus :)

=== Zope3/src/zope/app/dav/tests/test_propfind.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/dav/tests/test_propfind.py:1.2	Wed May 21 13:26:37 2003
+++ Zope3/src/zope/app/dav/tests/test_propfind.py	Wed May 21 16:29:46 2003
@@ -81,7 +81,7 @@
         return 'bla bla bla'
 
 
-def _createRequest(body=None, headers=None):
+def _createRequest(body=None, headers=None, skip_headers=None):
     if body is None:
         body = '''<?xml version="1.0" encoding="utf-8" ?>
 
@@ -102,6 +102,11 @@
         for key, value in headers.items():
             _environ[key.upper()] = value
 
+    if skip_headers is not None:
+        for key in skip_headers:
+            if _environ.has_key(key.upper()):
+                del _environ[key.upper()]
+
     request = TestRequest(StringIO(body), StringIO(), _environ)
     return request
 
@@ -166,6 +171,16 @@
         pfind.PROPFIND()
         # Check HTTP Response
         self.assertEqual(request.response.getStatus(), 207)
+
+    def test_no_contenttype(self):
+        file = self.file
+        request = _createRequest(skip_headers=('content-type'))
+
+        pfind = propfind.PROPFIND(file, request)
+        pfind.PROPFIND()
+        # Check HTTP Response
+        self.assertEqual(request.response.getStatus(), 207)
+        self.assertEqual(pfind.content_type, 'text/xml')
 
     def test_nodepth(self):
         file = self.file