From 8cf0ac0ea198a939c681c1755e5e961b57afe999 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 25 Jul 2021 12:18:39 +0300 Subject: [PATCH] cache unit tests ok --- app/scodoc/sco_cache.py | 4 ++-- tests/unit/test_caches.py | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/scodoc/sco_cache.py b/app/scodoc/sco_cache.py index 35f8e05f8..e57400c30 100644 --- a/app/scodoc/sco_cache.py +++ b/app/scodoc/sco_cache.py @@ -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 diff --git a/tests/unit/test_caches.py b/tests/unit/test_caches.py index 2139ba0d4..bfaa20878 100644 --- a/tests/unit/test_caches.py +++ b/tests/unit/test_caches.py @@ -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):