Exemplo n.º 1
0
 def test_load_from_dict(self):
     metainfo = {
         "info": {
             "name": "my_torrent",
             "piece length": 12345,
             "pieces": "12345678901234567890",
             "files": []
         }
     }
     torrent = TorrentDef.load_from_dict(metainfo)
     self.assertTrue(isValidTorrentFile(torrent.get_metainfo()))
Exemplo n.º 2
0
 def test_is_valid_torrent_file(self):
     self.assertTrue(
         isValidTorrentFile({
             "info": {
                 "name": "my_torrent",
                 "piece length": 12345,
                 "pieces": "12345678901234567890",
                 "files": [{
                     "length": 42,
                     "path": []
                 }]
             }
         }))
Exemplo n.º 3
0
 def general_check(self,metainfo):
     self.assert_(isValidTorrentFile(metainfo))
     self.assert_(metainfo['announce'] == TRACKER)
Exemplo n.º 4
0
 def general_check(self, metainfo):
     self.assertTrue(isValidTorrentFile(metainfo))
     self.assertEqual(metainfo['announce'], TRACKER)
Exemplo n.º 5
0
 def _on_load(torrent_def):
     self.assertTrue(isValidTorrentFile(torrent_def.get_metainfo()))
     self.assertEqual(TorrentDef.load(TORRENT_UBUNTU_FILE), torrent_def)
Exemplo n.º 6
0
 def test_is_valid_torrent_file_invalid(self):
     self.assertFalse(isValidTorrentFile({}))
 def general_check(self, metainfo):
     self.assert_(isValidTorrentFile(metainfo))
     self.assert_(metainfo['announce'] == TRACKER)