예제 #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({})