From 3062235cf2d0a200789e90a3fca847aad5da930e Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Wed, 30 Nov 2016 10:26:16 +0100 Subject: [tests] add unit tests for the keymanager token fix my goal here is also to start *real* unit tests for the keymanager, that do not need an actual soledad implementation. this should make all the coming tests much faster. I would like to have a common soledad stub that follows the soledad api, but w/o actual disk persistance, and migrate all the bulk of the keymanager tests to these unit tests. --- tests/unit/keymanager/test_unit_keymanager.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/unit/keymanager/test_unit_keymanager.py diff --git a/tests/unit/keymanager/test_unit_keymanager.py b/tests/unit/keymanager/test_unit_keymanager.py new file mode 100644 index 00000000..94e73d0f --- /dev/null +++ b/tests/unit/keymanager/test_unit_keymanager.py @@ -0,0 +1,25 @@ +from twisted.trial import unittest + +from leap.bitmask.keymanager import KeyManager + + +class KeymanagerTestCase(unittest.TestCase): + + def test_token_propagation(self): + km = keymanagerFactory() + assert km._nicknym.token == '' + km.token = 'sometoken' + assert km.token == 'sometoken' + assert km._nicknym.token == 'sometoken' + km.token = 'othertoken' + assert km.token == 'othertoken' + assert km._nicknym.token == 'othertoken' + + +def keymanagerFactory(): + + class DummyKeymanager(KeyManager): + def _init_gpg(self, soledad, gpg): + pass + + return DummyKeymanager('foo@localhost', 'localhost', None, token='') -- cgit v1.2.3