def test_validate_info_pieces_not_string(self): validate_torrent_info( {"info": { "name": "x", "piece length": 5, "pieces": 5 }})
def test_validate_info_root_hash_not_string(self): validate_torrent_info( {"info": { "name": "x", "piece length": 5, "root hash": 5 }})
def test_valid_torrent_file_root_hash_wrong_length(self): validate_torrent_info({ "info": { "name": "my_torrent", "piece length": 12345, "root hash": "12345" } })
def test_valid_torrent_file_info_pieces_wrong_type(self): validate_torrent_info({ "info": { "name": "my_torrent", "piece length": 12345, "pieces": 12345678901234567890 } })
def test_valid_torrent_file_info_name_wrong_type(self): validate_torrent_info({ "info": { "name": 42, "piece length": 12345, "pieces": "12345678901234567890" } })
def test_valid_torrent_root_hash(self): validate_torrent_info({ "info": { "name": "my_torrent", "piece length": 12345, "root hash": "12345678901234567890", "files": [] } })
def test_valid_torrent_file_both_length_files(self): validate_torrent_info({ "info": { "name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "length": 42, "files": [] } })
def test_validate_info_correct(self): info = { "info": { "name": "x", "piece length": 5, "pieces": "12345678901234567890", "length": 1 } } self.assertEquals(validate_torrent_info(info), info['info'])
def test_valid_torrent_root_hash(self): validate_torrent_info({"info": {"name": "my_torrent", "piece length": 12345, "root hash": "12345678901234567890", "files": []}})
def test_valid_torrent_file_info_length_wrong_type(self): validate_torrent_info({"info": {"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "length": "42"}})
def test_valid_torrent_file_both_length_files(self): validate_torrent_info({"info": {"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "length": 42, "files": []}})
def test_valid_torrent_file_root_hash_wrong_length(self): validate_torrent_info({"info": {"name": "my_torrent", "piece length": 12345, "root hash": "12345"}})
def test_valid_torrent_file_info_type(self): validate_torrent_info({"info": {}})
def test_validate_info_pieces_not_string(self): validate_torrent_info({"info": {"name": "x", "piece length": 5, "pieces": 5}})
def test_validate_info_length_not_num(self): validate_torrent_info({"info": {"name": "x", "piece length": "z"}})
def test_validate_info_length_not_num(self): validate_torrent_info({"info": {"name": "x", "piece length": "z"}})
def test_validate_info_root_hash_not_string(self): validate_torrent_info({"info": {"name": "x", "piece length": 5, "root hash": 5}})
def test_valid_torrent_file_info_type(self): validate_torrent_info({"info": {}})
def test_validate_info_correct(self): info = {"info": {"name": "x", "piece length": 5, "pieces": "12345678901234567890", "length": 1}} self.assertEquals(validate_torrent_info(info), info['info'])
def test_valid_torrent_file_info_wrong_type(self): validate_torrent_info({"info": []})
def test_valid_torrent_file_info_wrong_type(self): validate_torrent_info({"info": []})
def test_valid_torrent_file_info_name_wrong_type(self): validate_torrent_info({"info": {"name": 42, "piece length": 12345, "pieces": "12345678901234567890"}})