示例#1
0
    def test_http(self):
        torrent = Torrent('torrents/archlinux-2013.12.01-dual.iso.torrent')
        tracker = Tracker('http://tracker.archlinux.org:6969/announce', torrent)

        response = yield tracker.announce(utils.peer_id(), 6881)

        self.assertIsInstance(response, TrackerResponse)
示例#2
0
    def test_udp(self):
        torrent = Torrent('torrents/archlinux-2013.12.01-dual.iso.torrent')
        tracker = Tracker('udp://tracker.openbittorrent.com:80/announce', torrent)

        response = yield tracker.announce(utils.peer_id(), 6881)

        self.assertIsInstance(response, TrackerResponse)
示例#3
0
    def test_autodetect(self):
        self.assertIsInstance(Tracker('udp://tracker.openbittorrent.com:80/announce', None), UDPTracker)
        self.assertIsInstance(Tracker('http://torrent.ubuntu.com:6969/announce', None), HTTPTracker)

        self.assertRaises(ValueError, Tracker, 'gopher://tracker.openbittorrent.com:80/announce', None)
        self.assertRaises(ValueError, Tracker, 'tracker.openbittorrent.com:80/announce', None)