Ejemplo n.º 1
0
 def test_validate_info_pieces_not_string(self):
     validate_torrent_info(
         {"info": {
             "name": "x",
             "piece length": 5,
             "pieces": 5
         }})
Ejemplo n.º 2
0
 def test_validate_info_root_hash_not_string(self):
     validate_torrent_info(
         {"info": {
             "name": "x",
             "piece length": 5,
             "root hash": 5
         }})
Ejemplo n.º 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"
         }
     })
Ejemplo n.º 4
0
 def test_valid_torrent_file_info_pieces_wrong_type(self):
     validate_torrent_info({
         "info": {
             "name": "my_torrent",
             "piece length": 12345,
             "pieces": 12345678901234567890
         }
     })
Ejemplo n.º 5
0
 def test_valid_torrent_file_info_name_wrong_type(self):
     validate_torrent_info({
         "info": {
             "name": 42,
             "piece length": 12345,
             "pieces": "12345678901234567890"
         }
     })
Ejemplo n.º 6
0
 def test_valid_torrent_root_hash(self):
     validate_torrent_info({
         "info": {
             "name": "my_torrent",
             "piece length": 12345,
             "root hash": "12345678901234567890",
             "files": []
         }
     })
Ejemplo n.º 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": []
         }
     })
Ejemplo n.º 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'])
Ejemplo n.º 9
0
 def test_valid_torrent_root_hash(self):
     validate_torrent_info({"info": {"name": "my_torrent", "piece length": 12345,
                                     "root hash": "12345678901234567890", "files": []}})
Ejemplo n.º 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"}})
Ejemplo n.º 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": []}})
Ejemplo n.º 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"}})
Ejemplo n.º 13
0
 def test_valid_torrent_file_info_type(self):
     validate_torrent_info({"info": {}})
Ejemplo n.º 14
0
 def test_validate_info_pieces_not_string(self):
     validate_torrent_info({"info": {"name": "x", "piece length": 5, "pieces": 5}})
Ejemplo n.º 15
0
 def test_validate_info_length_not_num(self):
     validate_torrent_info({"info": {"name": "x", "piece length": "z"}})
Ejemplo n.º 16
0
 def test_validate_info_length_not_num(self):
     validate_torrent_info({"info": {"name": "x", "piece length": "z"}})
Ejemplo n.º 17
0
 def test_validate_info_root_hash_not_string(self):
     validate_torrent_info({"info": {"name": "x", "piece length": 5, "root hash": 5}})
Ejemplo n.º 18
0
 def test_valid_torrent_file_info_type(self):
     validate_torrent_info({"info": {}})
Ejemplo n.º 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'])
Ejemplo n.º 20
0
 def test_valid_torrent_file_info_wrong_type(self):
     validate_torrent_info({"info": []})
Ejemplo n.º 21
0
 def test_valid_torrent_file_info_wrong_type(self):
     validate_torrent_info({"info": []})
Ejemplo n.º 22
0
 def test_valid_torrent_file_info_name_wrong_type(self):
     validate_torrent_info({"info": {"name": 42, "piece length": 12345, "pieces": "12345678901234567890"}})