Add a test for sha1_hash

This commit is contained in:
Andrew Resch 2015-10-09 18:21:04 -07:00
parent a5010fd7af
commit e8efc8fd00
1 changed files with 8 additions and 0 deletions

View File

@ -3,6 +3,7 @@
import libtorrent as lt
import unittest
import binascii
# test torrent_info
@ -33,6 +34,13 @@ class test_bencoder(unittest.TestCase):
decoded = lt.bdecode(encoded)
self.assertEqual(decoded, {'a': 1, 'b': [1,2,3], 'c': 'foo'})
class test_sha1hash(unittest.TestCase):
def test_sha1hash(self):
h = 'a0'*20
s = lt.sha1_hash(binascii.unhexlify(h))
self.assertEqual(h, str(s))
if __name__ == '__main__':
unittest.main()