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()))
def test_is_valid_torrent_file(self): self.assertTrue( isValidTorrentFile({ "info": { "name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "files": [{ "length": 42, "path": [] }] } }))
def general_check(self,metainfo): self.assert_(isValidTorrentFile(metainfo)) self.assert_(metainfo['announce'] == TRACKER)
def general_check(self, metainfo): self.assertTrue(isValidTorrentFile(metainfo)) self.assertEqual(metainfo['announce'], TRACKER)
def _on_load(torrent_def): self.assertTrue(isValidTorrentFile(torrent_def.get_metainfo())) self.assertEqual(TorrentDef.load(TORRENT_UBUNTU_FILE), torrent_def)
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)