summaryrefslogtreecommitdiff
path: root/tests/unit/keymanager/test_unit_keymanager.py
blob: 94e73d0fd0cbede7aa25e57609da01b90118f5c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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='')