def test_valid_torrent_file_info_no_files(self): validate_files({ "name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "files": [] })
def test_valid_torrent_file_info_files_wrong_type(self): validate_files({ "name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "files": {} })
def test_valid_torrent_file_info_files_missing_path(self): validate_files({ "name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "files": [{ "length": 42 }] })
def test_valid_torrent_file_info_files_path_correct(self): validate_files({ "name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "files": [{ "length": 42, "path": ["/foo/bar"] }] })
def test_valid_torrent_file_info_files_path_wrong_type(self): validate_files({ "name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "files": [{ "length": 42, "path": [42] }] })
def test_valid_torrent_file_announce_list_wrong_type(self): validate_files({ "info": { "name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "length": 42 }, "announce-list": () })
def test_valid_torrent_file_info_files_length_wrong_type(self): validate_files({"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "files": [{"length": "42", "path": []}]})
def test_valid_torrent_file_info_files_empty_path(self): validate_files({"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "files": [{"length": 42, "path": []}]})
def test_validate_files_miss_filekey(self): validate_files({"files": [{"path": "xyz"}]})
def test_valid_torrent_file_info_files_path_list_wrong_type(self): validate_files({"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "files": [{"length": 42, "path": "/foo/bar"}]})
def test_valid_torrent_file_info_no_files(self): validate_files({"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "files": []})
def test_validate_files_path_not_string(self): validate_files({"files": [{"path": 5, "length": 8}]})
def test_validate_files_correct_single(self): self.assertEquals(validate_files({"length": 1}), None)
def test_valid_torrent_file_info_files_path_correct(self): validate_files({"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "files": [{"length": 42, "path": ["/foo/bar"]}]})
def test_valid_torrent_file_announce_list_wrong_type(self): validate_files({"info": {"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890", "length": 42}, "announce-list": ()})
def test_validate_files_nothing(self): validate_files({})