summaryrefslogtreecommitdiff
path: root/tests/unit/keymanager
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-11-30 10:26:16 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2016-11-30 10:55:02 +0100
commit3062235cf2d0a200789e90a3fca847aad5da930e (patch)
treebb895e39fb7c40d697a48c5d415e7d07be3dedfe /tests/unit/keymanager
parent7e7e54c5ef5a53e66e4bd0578b24bb1fc62db797 (diff)
[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.
Diffstat (limited to 'tests/unit/keymanager')
-rw-r--r--tests/unit/keymanager/test_unit_keymanager.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/unit/keymanager/test_unit_keymanager.py b/tests/unit/keymanager/test_unit_keymanager.py
new file mode 100644
index 0000000..94e73d0
--- /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='')