Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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()))
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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()))
Ejemplo n.º 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")
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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")
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)