You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by nl...@apache.org on 2005/10/22 18:42:53 UTC
svn commit: r327673 - in /httpd/mod_python/trunk/test: htdocs/tests.py
test.py
Author: nlehuen
Date: Sat Oct 22 09:42:47 2005
New Revision: 327673
URL: http://svn.apache.org/viewcvs?rev=327673&view=rev
Log:
Added another unit test for req.send_file().
Modified:
httpd/mod_python/trunk/test/htdocs/tests.py
httpd/mod_python/trunk/test/test.py
Modified: httpd/mod_python/trunk/test/htdocs/tests.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/htdocs/tests.py?rev=327673&r1=327672&r2=327673&view=diff
==============================================================================
--- httpd/mod_python/trunk/test/htdocs/tests.py (original)
+++ httpd/mod_python/trunk/test/htdocs/tests.py Sat Oct 22 09:42:47 2005
@@ -685,6 +685,19 @@
# os.remove(fname)
return apache.OK
+def req_sendfile2(req):
+
+ import tempfile
+ fname = tempfile.mktemp("txt")
+ f = open(fname, "w")
+ f.write("0123456789"*100);
+ f.close()
+
+ req.sendfile(fname)
+
+ # os.remove(fname)
+ return apache.OK
+
def srv_register_cleanup(req):
req.cleanup_data = "test ok"
Modified: httpd/mod_python/trunk/test/test.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/test.py?rev=327673&r1=327672&r2=327673&view=diff
==============================================================================
--- httpd/mod_python/trunk/test/test.py (original)
+++ httpd/mod_python/trunk/test/test.py Sat Oct 22 09:42:47 2005
@@ -618,13 +618,34 @@
def test_req_sendfile(self):
- print "\n * Testing req.sendfile()"
+ print "\n * Testing req.sendfile() with offset and length"
rsp = self.vhost_get("test_req_sendfile")
if (rsp != "test ok"):
self.fail(`rsp`)
+ def test_req_sendfile2_conf(self):
+
+ c = VirtualHost("*",
+ ServerName("test_req_sendfile2"),
+ DocumentRoot(DOCUMENT_ROOT),
+ Directory(DOCUMENT_ROOT,
+ SetHandler("mod_python"),
+ PythonHandler("tests::req_sendfile2"),
+ PythonDebug("On")))
+
+ return str(c)
+
+ def test_req_sendfile2(self):
+
+ print "\n * Testing req.sendfile() without offset and length"
+
+ rsp = self.vhost_get("test_req_sendfile2")
+
+ if (rsp != "0123456789"*100):
+ self.fail(`rsp`)
+
def test_PythonOption_conf(self):
c = VirtualHost("*",
@@ -1404,6 +1425,7 @@
perRequestSuite.addTest(PerRequestTestCase("test_req_register_cleanup"))
perRequestSuite.addTest(PerRequestTestCase("test_req_headers_out"))
perRequestSuite.addTest(PerRequestTestCase("test_req_sendfile"))
+ perRequestSuite.addTest(PerRequestTestCase("test_req_sendfile2"))
perRequestSuite.addTest(PerRequestTestCase("test_PythonOption"))
perRequestSuite.addTest(PerRequestTestCase("test_PythonOption_override"))
perRequestSuite.addTest(PerRequestTestCase("test_PythonOption_remove"))