From 2ac29247331ec89d60f0bdf5f682e63f5a22a65f Mon Sep 17 00:00:00 2001 From: Adrien Beraud <adrien.beraud@savoirfairelinux.com> Date: Tue, 28 Mar 2017 17:37:27 +0200 Subject: [PATCH] implement first simple unit tests --- python/tests/opendht_tests.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 python/tests/opendht_tests.py diff --git a/python/tests/opendht_tests.py b/python/tests/opendht_tests.py new file mode 100644 index 00000000..1944e30b --- /dev/null +++ b/python/tests/opendht_tests.py @@ -0,0 +1,22 @@ +import unittest +import opendht as dht + +class OpenDhtTester(unittest.TestCase): + + # test that DhtRunner can be instatiated and deleted without throwing + def test_instance(self): + for i in range(10): + r = dht.DhtRunner() + r.run() + del r + + # test that bootstraping works (raw address) + def test_bootstrap(self): + a = dht.DhtRunner() + a.run() + b = dht.DhtRunner() + b.run() + self.assertTrue(b.bootstrap(a.getBound())) + +if __name__ == '__main__': + unittest.main() -- GitLab