in python binding, make announce_entry::last_error a dict instead of error_code
This commit is contained in:
parent
3e83c4119f
commit
2258b53d87
|
@ -241,7 +241,10 @@ list trackers(torrent_handle& h)
|
|||
d["url"] = i->url;
|
||||
d["trackerid"] = i->trackerid;
|
||||
d["message"] = i->message;
|
||||
d["last_error"] = i->last_error;
|
||||
dict last_error;
|
||||
last_error["value"] = i->last_error.value();
|
||||
last_error["category"] = i->last_error.category().name();
|
||||
d["last_error"] = last_error;
|
||||
d["next_announce"] = i->next_announce;
|
||||
d["min_announce"] = i->min_announce;
|
||||
d["scrape_incomplete"] = i->scrape_incomplete;
|
||||
|
|
|
@ -85,7 +85,7 @@ class test_torrent_handle(unittest.TestCase):
|
|||
pickled_trackers = pickle.dumps(tracker_list)
|
||||
unpickled_trackers = pickle.loads(pickled_trackers)
|
||||
self.assertEqual(unpickled_trackers[0]['url'], 'udp://tracker1.com')
|
||||
self.assertEqual(unpickled_trackers[0]['last_error'].value(), 0)
|
||||
self.assertEqual(unpickled_trackers[0]['last_error']['value'], 0)
|
||||
|
||||
def test_file_status(self):
|
||||
self.setup()
|
||||
|
@ -105,6 +105,13 @@ class test_torrent_handle(unittest.TestCase):
|
|||
st2 = self.h.status()
|
||||
self.assertEqual(st2, st)
|
||||
|
||||
def test_serialize_trackers(self):
|
||||
"""Test to ensure the dict contains only python built-in types"""
|
||||
self.setup()
|
||||
self.h.add_tracker({'url':'udp://tracker1.com'})
|
||||
import json
|
||||
print(json.dumps(self.h.trackers()[0]))
|
||||
|
||||
def test_scrape(self):
|
||||
self.setup()
|
||||
# this is just to make sure this function can be called like this
|
||||
|
|
Loading…
Reference in New Issue