pass unit test_caches

This commit is contained in:
Emmanuel Viennet 2021-08-10 13:20:35 +02:00
parent 068d2a659e
commit 5d13195070
2 changed files with 7 additions and 4 deletions

View File

@ -80,7 +80,7 @@ class ScoDocCache:
@classmethod
def get(cls, oid):
"""Returns cached evaluation, or None"""
"""Returns cached object, or None"""
try:
return CACHE.get(cls._get_key(oid))
except:
@ -129,7 +129,7 @@ class EvaluationCache(ScoDocCache):
"delete evaluations in this formsemestre from cache"
req = """SELECT e.id
FROM notes_formsemestre s, notes_evaluation e, notes_moduleimpl m
WHERE s.id = %(formsemestre_id)s and s.id=m.id and e.moduleimpl_id=m.id;
WHERE s.id = %(formsemestre_id)s and s.id=m.formsemestre_id and e.moduleimpl_id=m.id;
"""
evaluation_ids = [
x[0] for x in ndb.SimpleQuery(req, {"formsemestre_id": formsemestre_id})

View File

@ -17,7 +17,7 @@ from app.scodoc import sco_evaluations
from app.scodoc import sco_formsemestre
from app.scodoc import notesdb as ndb
from config import TestConfig
from tests.unit.test_sco_basic import run_sco_basic
DEPT = TestConfig.DEPT_TEST
context = None # #context
@ -28,7 +28,7 @@ def test_notes_table(test_client):
ndb.set_sco_dept(DEPT)
assert g.scodoc_dept == DEPT
# prépare le département avec quelques semestres:
run_scenario1()
run_sco_basic()
#
sems = sco_formsemestre.do_formsemestre_list(context)
assert len(sems)
@ -50,6 +50,9 @@ def test_cache_evaluations(test_client):
""""""
# cherche un semestre ayant des evaluations
ndb.set_sco_dept(DEPT)
# prépare le département avec quelques semestres:
run_sco_basic()
#
sems = sco_formsemestre.do_formsemestre_list(None)
assert len(sems)
sem_evals = []