Пример #1
0
 def test_valid_torrent_file_info_no_files(self):
     validate_files({
         "name": "my_torrent",
         "piece length": 12345,
         "pieces": "12345678901234567890",
         "files": []
     })
Пример #2
0
 def test_valid_torrent_file_info_files_wrong_type(self):
     validate_files({
         "name": "my_torrent",
         "piece length": 12345,
         "pieces": "12345678901234567890",
         "files": {}
     })
Пример #3
0
 def test_valid_torrent_file_info_files_missing_path(self):
     validate_files({
         "name": "my_torrent",
         "piece length": 12345,
         "pieces": "12345678901234567890",
         "files": [{
             "length": 42
         }]
     })
Пример #4
0
 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"]
         }]
     })
Пример #5
0
 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]
         }]
     })
Пример #6
0
 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": ()
     })
Пример #7
0
 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": []}]})
Пример #8
0
 def test_valid_torrent_file_info_files_empty_path(self):
     validate_files({"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890",
                     "files": [{"length": 42, "path": []}]})
Пример #9
0
 def test_validate_files_miss_filekey(self):
     validate_files({"files": [{"path": "xyz"}]})
Пример #10
0
 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"}]})
Пример #11
0
 def test_valid_torrent_file_info_no_files(self):
     validate_files({"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890",
                     "files": []})
Пример #12
0
 def test_validate_files_miss_filekey(self):
     validate_files({"files": [{"path": "xyz"}]})
Пример #13
0
 def test_validate_files_path_not_string(self):
     validate_files({"files": [{"path": 5, "length": 8}]})
Пример #14
0
 def test_validate_files_correct_single(self):
     self.assertEquals(validate_files({"length": 1}), None)
Пример #15
0
 def test_validate_files_path_not_string(self):
     validate_files({"files": [{"path": 5, "length": 8}]})
Пример #16
0
 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"]}]})
Пример #17
0
 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": ()})
Пример #18
0
 def test_validate_files_nothing(self):
     validate_files({})
Пример #19
0
 def test_validate_files_correct_single(self):
     self.assertEquals(validate_files({"length": 1}), None)
Пример #20
0
 def test_validate_files_nothing(self):
     validate_files({})