Wrote test f...
Content-type: text/plain

Author: johnnyg

Revision: 5513

Log:
        Updated docstring in add_torrent_url.
Wrote test for add_torrent_url which tests sending headers.

Diff:
Modified: trunk/deluge/core/core.py
===================================================================
--- trunk/deluge/core/core.py   2009-07-20 10:51:33 UTC (rev 5512)
+++ trunk/deluge/core/core.py   2009-07-21 02:45:16 UTC (rev 5513)
@@ -271,8 +271,7 @@
         :param options: dict, the options to apply to the torrent on add
         :param headers: dict, any optional headers to send
 
-        :returns: the torrent_id as a str or None, if calling locally, then it
-            will return a Deferred that fires once the torrent has been added
+        :returns: a Deferred which returns the torrent_id as a str or None
         """
         log.info("Attempting to add url %s", url)
         def on_get_file(result):

Modified: trunk/tests/test_core.py
===================================================================
--- trunk/tests/test_core.py    2009-07-20 10:51:33 UTC (rev 5512)
+++ trunk/tests/test_core.py    2009-07-21 02:45:16 UTC (rev 5513)
@@ -1,4 +1,5 @@
 from twisted.trial import unittest
+from twisted.python.failure import Failure
 
 try:
     from hashlib import sha1 as sha
@@ -45,6 +46,20 @@
         d.addCallback(self.assertEquals, info_hash)
         return d
 
+    def test_add_torrent_url_with_cookie(self):
+        url = "http://cgi.cse.unsw.edu.au/~johnnyg/torrent.php";
+        options = {}
+        headers = { "Cookie" : "password=deluge" }
+        info_hash = "60d5d82328b4547511fdeac9bf4d0112daa0ce00"
+
+        d = self.core.add_torrent_url(url, options)
+        d.addCallbacks(self.fail, self.assertIsInstance, Failure)
+
+        d = self.core.add_torrent_url(url, options, headers)
+        d.addCallback(self.assertEquals, info_hash)
+
+        return d
+
     def test_add_magnet(self):
         info_hash = "60d5d82328b4547511fdeac9bf4d0112daa0ce00"
         import deluge.common



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to