mirror of
https://github.com/senju1337/senju.git
synced 2025-12-24 07:39:29 +00:00
test: tests for the new haiku specific methods of the store manager
Refs: OPS-22
This commit is contained in:
parent
3a36366865
commit
602cba280a
1 changed files with 18 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
# pytest fixtures to work
|
# pytest fixtures to work
|
||||||
import pytest # noqa: F401
|
import pytest # noqa: F401
|
||||||
|
|
||||||
|
from senju.haiku import Haiku
|
||||||
from senju.store_manager import StoreManager # noqa: F401
|
from senju.store_manager import StoreManager # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -21,3 +22,20 @@ def test_save_and_load_any(store_manager: StoreManager):
|
||||||
should have"
|
should have"
|
||||||
for key in thing.keys():
|
for key in thing.keys():
|
||||||
assert thing[key] == thing_loaded[key]
|
assert thing[key] == thing_loaded[key]
|
||||||
|
|
||||||
|
|
||||||
|
def test_save_and_load_haiku(store_manager: StoreManager):
|
||||||
|
h = Haiku(text="foobar")
|
||||||
|
hid = store_manager.save_haiku(h)
|
||||||
|
h_loaded = store_manager.load_haiku(hid)
|
||||||
|
|
||||||
|
if h_loaded is None:
|
||||||
|
assert False, "store manager load_haiku did not return anything \
|
||||||
|
but should have"
|
||||||
|
|
||||||
|
assert h == h_loaded
|
||||||
|
|
||||||
|
|
||||||
|
def test_load_latest_with_empty_store(store_manager: StoreManager):
|
||||||
|
h = store_manager.load_latest_haiku()
|
||||||
|
assert h is None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue