summaryrefslogtreecommitdiff
path: root/macaroonbakery/tests/test_store.py
blob: 8a54f5912c34a99d9473ff9101fa35c1c2a89959 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright 2017 Canonical Ltd.
# Licensed under the LGPLv3, see LICENCE file for details.
from unittest import TestCase

import macaroonbakery.bakery as bakery


class TestOven(TestCase):
    def test_mem_store(self):
        st = bakery.MemoryKeyStore()

        key, id = st.root_key()
        self.assertEqual(len(key), 24)
        self.assertEqual(id.decode('utf-8'), '0')

        key1, id1 = st.root_key()
        self.assertEqual(key1, key)
        self.assertEqual(id1, id)

        key2 = st.get(id)
        self.assertEqual(key2, key)