Beispiel #1
0
 def test_valid_torrent_file_info_no_files(self):
     validate_files({
         "name": "my_torrent",
         "piece length": 12345,
         "pieces": "12345678901234567890",
         "files": []
     })
Beispiel #2
0
 def test_valid_torrent_file_info_files_wrong_type(self):
     validate_files({
         "name": "my_torrent",
         "piece length": 12345,
         "pieces": "12345678901234567890",
         "files": {}
     })
Beispiel #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
         }]
     })
Beispiel #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"]
         }]
     })
Beispiel #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]
         }]
     })
Beispiel #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": ()
     })
Beispiel #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": []}]})
Beispiel #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": []}]})
Beispiel #9
0
 def test_validate_files_miss_filekey(self):
     validate_files({"files": [{"path": "xyz"}]})
Beispiel #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"}]})
Beispiel #11
0
 def test_valid_torrent_file_info_no_files(self):
     validate_files({"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890",
                     "files": []})
Beispiel #12
0
 def test_validate_files_miss_filekey(self):
     validate_files({"files": [{"path": "xyz"}]})
Beispiel #13
0
 def test_validate_files_path_not_string(self):
     validate_files({"files": [{"path": 5, "length": 8}]})
Beispiel #14
0
 def test_validate_files_correct_single(self):
     self.assertEquals(validate_files({"length": 1}), None)
Beispiel #15
0
 def test_validate_files_path_not_string(self):
     validate_files({"files": [{"path": 5, "length": 8}]})
Beispiel #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"]}]})
Beispiel #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": ()})
Beispiel #18
0
 def test_validate_files_nothing(self):
     validate_files({})
Beispiel #19
0
 def test_validate_files_correct_single(self):
     self.assertEquals(validate_files({"length": 1}), None)
Beispiel #20
0
 def test_validate_files_nothing(self):
     validate_files({})