Make it compat...
Content-type: text/plain
Author: johnnyg
Revision: 6052
Log:
Add another test to httpdownloader.
Make it compatible with python 2.5.
Diff:
Modified: trunk/tests/test_httpdownloader.py
===================================================================
--- trunk/tests/test_httpdownloader.py 2009-12-21 10:26:50 UTC (rev 6051)
+++ trunk/tests/test_httpdownloader.py 2009-12-21 13:48:00 UTC (rev 6052)
@@ -4,6 +4,8 @@
from deluge.httpdownloader import download_file
from deluge.log import setupLogger
+from email.utils import formatdate
+
class DownloadFileTestCase(unittest.TestCase):
def setUp(self):
setupLogger("warning", "log_file")
@@ -12,8 +14,11 @@
pass
def assertContains(self, filename, contents):
- with open(filename) as f:
+ f = open(filename)
+ try:
self.assertEqual(f.read(), contents)
+ finally:
+ f.close()
return filename
def test_download(self):
@@ -82,3 +87,10 @@
d.addCallback(self.fail)
d.addErrback(self.assertIsInstance, Failure)
return d
+
+ def test_page_not_modified(self):
+ headers = { 'If-Modified-Since' : formatdate(usegmt=True) }
+ d = download_file("http://deluge-torrent.org", "index.html",
headers=headers)
+ d.addCallback(self.fail)
+ d.addErrback(self.assertIsInstance, Failure)
+ return d
--
You received this message because you are subscribed to the Google Groups
"deluge-commit" 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/deluge-commit?hl=en.