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