diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_stash.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/test_stash.py b/tests/test_stash.py index b87c882..defdd7e 100644 --- a/tests/test_stash.py +++ b/tests/test_stash.py @@ -1,9 +1,27 @@ from pathlib import Path from ymlstash import YmlStash +from dataclasses import dataclass + + +@dataclass +class User: + name: str + age: int def test_stash_path(): - stash = YmlStash("foo") + stash = YmlStash(User, "foo") assert stash.path == Path("foo") - stash = YmlStash(Path("foo")) + stash = YmlStash(User, Path("foo")) assert stash.path == Path("foo") + + +def test_stash(): + stash = YmlStash(User, "/tmp/") + yuval = User(name="yuval", age=42) + stash.save("foo", yuval) + assert stash.list_all_keys() == ["foo"] + obj = stash.load("foo") + assert obj == yuval + stash.drop() + assert stash.list_all_keys() == [] |
