add python binding for generate_fingerprint

This commit is contained in:
arvidn 2017-01-15 13:46:08 -05:00 committed by Arvid Norberg
parent 04589f3bef
commit 27001750a4
2 changed files with 6 additions and 0 deletions

View File

@ -10,6 +10,8 @@ void bind_fingerprint()
using namespace boost::python;
using namespace libtorrent;
def("generate_fingerprint", &generate_fingerprint);
#ifndef TORRENT_NO_DEPRECATE
class_<fingerprint>("fingerprint", no_init)
.def(

View File

@ -230,6 +230,10 @@ class test_session(unittest.TestCase):
except KeyError as e:
print(e)
def test_fingerprint(self):
self.assertEqual(lt.generate_fingerprint('LT', 0, 1, 2, 3), '-LT0123-')
self.assertEqual(lt.generate_fingerprint('..', 10, 1, 2, 3), '-..A123-')
def test_deprecated_settings(self):
# this detects whether libtorrent was built with deprecated APIs