示例#1
0
 def test_get_length(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(test_data.get_length(), 1150844928)
     self.assertEqual(test_data.get_length(), test_data.length)
     self.assertEqual(test_data.length, test_data.left)
示例#2
0
 def test_get_length(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(test_data.get_length(), 1150844928)
     self.assertEqual(test_data.get_length(), test_data.length)
     self.assertEqual(test_data.length, test_data.left)
示例#3
0
 def test_trackers(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(
         test_data.get_trackers(),
         [["http://torrent.ubuntu.com:6969/announce"], ["http://ipv6.torrent.ubuntu.com:6969/announce"]],
     )
     self.assertEqual(test_data.get_trackers(), test_data.trackers)
示例#4
0
 def test_creation_date(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(test_data.get_creation_date(), test_data.creation_date)
示例#5
0
 def test_info_hash(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(test_data.get_info_hash(), 'fc8a15a2faf2734dbb1dc5f7afdc5c9beaeb1f59')
     self.assertEqual(test_data.get_info_hash(), test_data.info_hash)
示例#6
0
 def test_info_hash_hex(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(len(test_data.info_hash_hex), 20)
示例#7
0
 def test_reserved(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(len(test_data.RESERVED), 8)
示例#8
0
 def test_id(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(len(test_data.ID), 2)
示例#9
0
 def test_version(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(len(test_data.VERSION), 4)
示例#10
0
 def test_id(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(len(test_data.ID), 2)
示例#11
0
 def test_peer_id(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(20, len(test_data.gen_peer_id()))
示例#12
0
 def test_ip(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(ipgetter.myip(), test_data.IP)
示例#13
0
 def test_creation_date(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(test_data.get_creation_date(), test_data.creation_date)
示例#14
0
 def test_info_hash(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(test_data.get_info_hash(), "fc8a15a2faf2734dbb1dc5f7afdc5c9beaeb1f59")
     self.assertEqual(test_data.get_info_hash(), test_data.info_hash)
示例#15
0
 def test_ip(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(ipgetter.myip(), test_data.IP)
示例#16
0
 def test_reserved(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(len(test_data.RESERVED), 8)
示例#17
0
 def test_peer_id(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(20, len(test_data.gen_peer_id()))
示例#18
0
 def test_protocol(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(test_data.PROTOCOL, "BitTorrent protocol")
示例#19
0
 def test_version(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(len(test_data.VERSION), 4)
示例#20
0
 def test_info_hash(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(len(test_data.info_hash), 40)
示例#21
0
 def test_protocol(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(test_data.PROTOCOL, "BitTorrent protocol")
示例#22
0
 def test_trackers(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(test_data.get_trackers(),[['http://torrent.ubuntu.com:6969/announce'], ['http://ipv6.torrent.ubuntu.com:6969/announce']])
     self.assertEqual(test_data.get_trackers(), test_data.trackers)
示例#23
0
 def test_handshake(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(len(test_data.handshake), 69)
示例#24
0
 def test_handshake(self):
     test_file = get_test_file()
     self.test_file = test_file.test_file
     test_data = data.get_data(self.test_file)
     self.assertEqual(len(test_data.handshake), 69)