Author: ccahoon
Date: 2009-07-09 14:53:12 -0500 (Thu, 09 Jul 2009)
New Revision: 11210

Modified:
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/sendfile/tests.py
Log:
[soc2009/http-wsgi-improvement] Repairs to initial regressiontests.sendfile 
test to fix temp file usage.

Modified: 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/sendfile/tests.py
===================================================================
--- 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/sendfile/tests.py
      2009-07-09 17:45:59 UTC (rev 11209)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/sendfile/tests.py
      2009-07-09 19:53:12 UTC (rev 11210)
@@ -10,7 +10,6 @@
 class SendFileTests(TestCase):
     def test_sendfile(self):
         tdir = tempfile.gettempdir()
-
         file1 = tempfile.NamedTemporaryFile(suffix=".pdf", dir=tdir)
         file1.write(CONTENT)
         file1.seek(0)
@@ -18,8 +17,6 @@
         response = self.client.get('/sendfile/serve_file/%s/' %
                 urllib.quote(file1.name))
 
-        file1.close()
-
         self.assertEqual(response.status_code, 200)
         self.assertEqual(response[settings.HTTPRESPONSE_SENDFILE_HEADER],
                 file1.name)
@@ -29,8 +26,9 @@
         self.assertEqual(response['Content-Type'], 'application/pdf')
 
         # *if* the degraded case is to be supported, add this instead:
-        # self.assertEqual(response.content, CONTENT)
-        get_content = lambda: response.content
-        self.assertRaises(TypeError, get_content)
+        self.assertEqual(response.content, CONTENT)
+        get_content = lambda: response.content.read()
+        #self.assertRaises(TypeError, get_content)
 
+        file1.close()
         # TODO: test middleware bypass etc


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to