コード例 #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
ファイル: test_utilities.py プロジェクト: synctext/tribler
 def test_valid_torrent_root_hash(self):
     validate_torrent_info({"info": {"name": "my_torrent", "piece length": 12345,
                                     "root hash": "12345678901234567890", "files": []}})
コード例 #10
0
ファイル: test_utilities.py プロジェクト: synctext/tribler
 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
ファイル: test_utilities.py プロジェクト: synctext/tribler
 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
ファイル: test_utilities.py プロジェクト: synctext/tribler
 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
ファイル: test_utilities.py プロジェクト: synctext/tribler
 def test_valid_torrent_file_info_type(self):
     validate_torrent_info({"info": {}})
コード例 #14
0
ファイル: test_utilities.py プロジェクト: synctext/tribler
 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
ファイル: test_utilities.py プロジェクト: synctext/tribler
 def test_validate_info_length_not_num(self):
     validate_torrent_info({"info": {"name": "x", "piece length": "z"}})
コード例 #17
0
ファイル: test_utilities.py プロジェクト: synctext/tribler
 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
ファイル: test_utilities.py プロジェクト: synctext/tribler
 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
ファイル: test_utilities.py プロジェクト: synctext/tribler
 def test_valid_torrent_file_info_wrong_type(self):
     validate_torrent_info({"info": []})
コード例 #22
0
ファイル: test_utilities.py プロジェクト: synctext/tribler
 def test_valid_torrent_file_info_name_wrong_type(self):
     validate_torrent_info({"info": {"name": 42, "piece length": 12345, "pieces": "12345678901234567890"}})