From c7621caf782e44c76d2477813726ea35de00d49c Mon Sep 17 00:00:00 2001 From: Tobi-wan Kenobi Date: Sun, 5 Mar 2017 13:04:20 +0100 Subject: [PATCH] [tests] Add unit tests for the store class --- tests/test_store.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/test_store.py diff --git a/tests/test_store.py b/tests/test_store.py new file mode 100644 index 0000000..faa1efb --- /dev/null +++ b/tests/test_store.py @@ -0,0 +1,26 @@ +# pylint: disable=C0103,C0111,W0703 + +import unittest + +from bumblebee.store import Store + +class TestStore(unittest.TestCase): + def setUp(self): + self.store = Store() + self.anyKey = "some-key" + self.anyValue = "some-value" + self.unsetKey = "invalid-key" + + def test_set_value(self): + self.store.set(self.anyKey, self.anyValue) + self.assertEquals(self.store.get(self.anyKey), self.anyValue) + + def test_get_invalid_value(self): + result = self.store.get(self.unsetKey) + self.assertEquals(result, None) + + def test_get_invalid_with_default_value(self): + result = self.store.get(self.unsetKey, self.anyValue) + self.assertEquals(result, self.anyValue) + +# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4