From 77bb7f5be79743037ae7fa859913a6e4e8c45fd2 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 18 Apr 2017 22:50:59 -0400 Subject: [PATCH] test_wormhole: improve tests of derive_key() --- src/wormhole/test/test_wormhole.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wormhole/test/test_wormhole.py b/src/wormhole/test/test_wormhole.py index 56a9c67..8c99081 100644 --- a/src/wormhole/test/test_wormhole.py +++ b/src/wormhole/test/test_wormhole.py @@ -143,6 +143,9 @@ class Wormholes(ServerBase, unittest.TestCase): def test_basic(self): w1 = wormhole.create(APPID, self.relayurl, reactor) #w1.debug_set_trace("W1") + with self.assertRaises(NoKeyError): + w1.derive_key("purpose", 12) + w2 = wormhole.create(APPID, self.relayurl, reactor) #w2.debug_set_trace(" W2") w1.allocate_code() @@ -152,6 +155,9 @@ class Wormholes(ServerBase, unittest.TestCase): yield w1.when_key() yield w2.when_key() + key1 = w1.derive_key("purpose", 16) + self.assertEqual(len(key1), 16) + self.assertEqual(type(key1), type(b"")) with self.assertRaises(TypeError): w1.derive_key(b"not unicode", 16) with self.assertRaises(TypeError):