[tests] Add unit tests for the store class
This commit is contained in:
parent
00849aa4fa
commit
c7621caf78
1 changed files with 26 additions and 0 deletions
26
tests/test_store.py
Normal file
26
tests/test_store.py
Normal file
|
@ -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
|
Loading…
Reference in a new issue