From c32d6a46fc48581b3169f1d6f4fe468cda2a19a8 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Wed, 17 Mar 2021 00:46:21 -0500 Subject: [PATCH] Cache test --- tests/test_cache.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/test_cache.py b/tests/test_cache.py index 7ff0fc1..9458e14 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -1,3 +1,30 @@ import pytest - +from pathlib import Path from tibi_hardlinks.cache import Cache + + +def test_cache_init(tmp_path): + Cache(tmp_path) + + +def test_cache_store(tmp_path): + Cache(tmp_path).store() + + +def test_cache_load(tmp_path): + Cache(tmp_path).store() + Cache(tmp_path).load() + + +def test_cache_read_write(tmp_path): + c = Cache(tmp_path) + c.write("key", "val") + assert c.read("key") == "val" + + +def test_cache_write_store_load_read(tmp_path): + c = Cache(tmp_path) + c.write("key", "val") + c.store() + c_load = Cache(tmp_path) + assert c_load.read("key") == "val"