1
0
forked from ScoDoc/ScoDoc

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): def set(cls, oid, value):
"""Store value""" """Store value"""
key = cls._get_key(oid) 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) status = CACHE.set(key, value, timeout=cls.timeout)
if not status: if not status:
log("Error: cache set failed") log("Error: cache set failed !")
return status return status
@classmethod @classmethod

View File

@ -30,15 +30,11 @@ def test_notes_table(test_client):
assert sco_cache.NotesTableCache.get(formsemestre_id, compute=False) assert sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
sco_cache.invalidate_formsemestre(formsemestre_id) sco_cache.invalidate_formsemestre(formsemestre_id)
assert not sco_cache.NotesTableCache.get(formsemestre_id, compute=False) assert not sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
# cache les 5 premiers # cache les 10 premiers
for sem in sems[:5]: for sem in sems[:10]:
formsemestre_id = sem["formsemestre_id"] formsemestre_id = sem["formsemestre_id"]
nt = sco_cache.NotesTableCache.get(formsemestre_id) nt = sco_cache.NotesTableCache.get(formsemestre_id)
assert sco_cache.NotesTableCache.get(formsemestre_id, compute=False) 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): def test_cache_evaluations(test_client):