cache unit tests ok

This commit is contained in:
Emmanuel Viennet 2021-07-25 12:18:39 +03:00
parent b3e0e1ad12
commit 8cf0ac0ea1
2 changed files with 4 additions and 8 deletions

View File

@ -86,10 +86,10 @@ class ScoDocCache:
def set(cls, oid, value):
"""Store value"""
key = cls._get_key(oid)
log(f"CACHE key={key}, timeout={cls.timeout}")
# log(f"CACHE key={key}, timeout={cls.timeout}")
status = CACHE.set(key, value, timeout=cls.timeout)
if not status:
log("Error: cache set failed")
log("Error: cache set failed !")
return status
@classmethod

View File

@ -30,15 +30,11 @@ def test_notes_table(test_client):
assert sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
sco_cache.invalidate_formsemestre(formsemestre_id)
assert not sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
# cache les 5 premiers
for sem in sems[:5]:
# cache les 10 premiers
for sem in sems[:10]:
formsemestre_id = sem["formsemestre_id"]
nt = sco_cache.NotesTableCache.get(formsemestre_id)
assert sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
# assert "SEM38882" in {s["formsemestre_id"] for s in sems}
# formsemestre_id = "SEM38882"
# nt = sco_cache.NotesTableCache.get(formsemestre_id)
# assert sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
def test_cache_evaluations(test_client):