Пример #1
0
 def test_validate_info_pieces_not_string(self):
     validate_torrent_info(
         {"info": {
             "name": "x",
             "piece length": 5,
             "pieces": 5
         }})
Пример #2
0
 def test_validate_info_root_hash_not_string(self):
     validate_torrent_info(
         {"info": {
             "name": "x",
             "piece length": 5,
             "root hash": 5
         }})
Пример #3
0
 def test_valid_torrent_file_root_hash_wrong_length(self):
     validate_torrent_info({
         "info": {
             "name": "my_torrent",
             "piece length": 12345,
             "root hash": "12345"
         }
     })
Пример #4
0
 def test_valid_torrent_file_info_pieces_wrong_type(self):
     validate_torrent_info({
         "info": {
             "name": "my_torrent",
             "piece length": 12345,
             "pieces": 12345678901234567890
         }
     })
Пример #5
0
 def test_valid_torrent_file_info_name_wrong_type(self):
     validate_torrent_info({
         "info": {
             "name": 42,
             "piece length": 12345,
             "pieces": "12345678901234567890"
         }
     })
Пример #6
0
 def test_valid_torrent_root_hash(self):
     validate_torrent_info({
         "info": {
             "name": "my_torrent",
             "piece length": 12345,
             "root hash": "12345678901234567890",
             "files": []
         }
     })
Пример #7
0
 def test_valid_torrent_file_both_length_files(self):
     validate_torrent_info({
         "info": {
             "name": "my_torrent",
             "piece length": 12345,
             "pieces": "12345678901234567890",
             "length": 42,
             "files": []
         }
     })
Пример #8
0
 def test_validate_info_correct(self):
     info = {
         "info": {
             "name": "x",
             "piece length": 5,
             "pieces": "12345678901234567890",
             "length": 1
         }
     }
     self.assertEquals(validate_torrent_info(info), info['info'])
Пример #9
0
 def test_valid_torrent_root_hash(self):
     validate_torrent_info({"info": {"name": "my_torrent", "piece length": 12345,
                                     "root hash": "12345678901234567890", "files": []}})
Пример #10
0
 def test_valid_torrent_file_info_length_wrong_type(self):
     validate_torrent_info({"info": {"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890",
                                     "length": "42"}})
Пример #11
0
 def test_valid_torrent_file_both_length_files(self):
     validate_torrent_info({"info": {"name": "my_torrent", "piece length": 12345, "pieces": "12345678901234567890",
                                     "length": 42, "files": []}})
Пример #12
0
 def test_valid_torrent_file_root_hash_wrong_length(self):
     validate_torrent_info({"info": {"name": "my_torrent", "piece length": 12345, "root hash": "12345"}})
Пример #13
0
 def test_valid_torrent_file_info_type(self):
     validate_torrent_info({"info": {}})
Пример #14
0
 def test_validate_info_pieces_not_string(self):
     validate_torrent_info({"info": {"name": "x", "piece length": 5, "pieces": 5}})
Пример #15
0
 def test_validate_info_length_not_num(self):
     validate_torrent_info({"info": {"name": "x", "piece length": "z"}})
Пример #16
0
 def test_validate_info_length_not_num(self):
     validate_torrent_info({"info": {"name": "x", "piece length": "z"}})
Пример #17
0
 def test_validate_info_root_hash_not_string(self):
     validate_torrent_info({"info": {"name": "x", "piece length": 5, "root hash": 5}})
Пример #18
0
 def test_valid_torrent_file_info_type(self):
     validate_torrent_info({"info": {}})
Пример #19
0
 def test_validate_info_correct(self):
     info = {"info": {"name": "x", "piece length": 5, "pieces": "12345678901234567890", "length": 1}}
     self.assertEquals(validate_torrent_info(info), info['info'])
Пример #20
0
 def test_valid_torrent_file_info_wrong_type(self):
     validate_torrent_info({"info": []})
Пример #21
0
 def test_valid_torrent_file_info_wrong_type(self):
     validate_torrent_info({"info": []})
Пример #22
0
 def test_valid_torrent_file_info_name_wrong_type(self):
     validate_torrent_info({"info": {"name": 42, "piece length": 12345, "pieces": "12345678901234567890"}})