Skip to content
Snippets Groups Projects
Commit 2e25a56d authored by Carsten Hinz's avatar Carsten Hinz
Browse files

worked on tests for cache class

parent 001529da
No related branches found
No related tags found
2 merge requests!11Creation of first beta release version,!7Resolve "Cache and requests: Handling of dead status endpoints (Internal Server Error, old requests)"
#script to test the cache for the rest client. #script to test the cache for the rest client.
import pytest
from unittest import mock
import datetime
from toargridding.toar_rest_client import Cache from toargridding.toar_rest_client import Cache
from pathlib import Path from pathlib import Path
def test_cache(): def test_cache():
myTestCache = Cache( cache_dir=Path("cache"), fn="testingOfCache") myTestCache = Cache( cache_dir=Path("cache"), fn="testingOfCache")
...@@ -14,6 +16,8 @@ def test_cache(): ...@@ -14,6 +16,8 @@ def test_cache():
assert "test key 1" in myTestCache assert "test key 1" in myTestCache
assert "test key 2" in myTestCache assert "test key 2" in myTestCache
assert myTestCache.get("test key 1") == "test content 1" assert myTestCache.get("test key 1") == "test content 1"
myTestCache.clearCache()
assert "test key 2" in myTestCache
#edit creation date of key 2: #edit creation date of key 2:
with myTestCache.storage_dict() as storage: with myTestCache.storage_dict() as storage:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment