forked from ScoDoc/ScoDoc
edition formations / tests unitaires ok
This commit is contained in:
parent
e3535aa4da
commit
5895e5c33c
@ -49,9 +49,7 @@ class Module(db.Model):
|
|||||||
super(Module, self).__init__(**kwargs)
|
super(Module, self).__init__(**kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return (
|
return f"<Module{ModuleType(self.module_type or ModuleType.STANDARD).name} id={self.id} code={self.code}>"
|
||||||
f"<Module{ModuleType(self.module_type).name} id={self.id} code={self.code}>"
|
|
||||||
)
|
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
e = dict(self.__dict__)
|
e = dict(self.__dict__)
|
||||||
|
@ -211,7 +211,7 @@ def do_ue_delete(ue_id, delete_validations=False, force=False):
|
|||||||
F = sco_formations.formation_list(args={"formation_id": ue.formation_id})[0]
|
F = sco_formations.formation_list(args={"formation_id": ue.formation_id})[0]
|
||||||
sco_news.add(
|
sco_news.add(
|
||||||
typ=sco_news.NEWS_FORM,
|
typ=sco_news.NEWS_FORM,
|
||||||
object=ue["formation_id"],
|
object=ue.formation_id,
|
||||||
text="Modification de la formation %(acronyme)s" % F,
|
text="Modification de la formation %(acronyme)s" % F,
|
||||||
max_frequency=3,
|
max_frequency=3,
|
||||||
)
|
)
|
||||||
@ -221,7 +221,7 @@ def do_ue_delete(ue_id, delete_validations=False, force=False):
|
|||||||
url_for(
|
url_for(
|
||||||
"notes.ue_table",
|
"notes.ue_table",
|
||||||
scodoc_dept=g.scodoc_dept,
|
scodoc_dept=g.scodoc_dept,
|
||||||
formation_id=ue["formation_id"],
|
formation_id=ue.formation_id,
|
||||||
semestre_idx=ue.semestre_idx,
|
semestre_idx=ue.semestre_idx,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -42,17 +42,17 @@
|
|||||||
# - do_formation_delete
|
# - do_formation_delete
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import xml.dom.minidom
|
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
from flask import g
|
from flask import g
|
||||||
|
import pytest
|
||||||
from tests.unit import sco_fake_gen
|
from tests.unit import sco_fake_gen
|
||||||
|
|
||||||
from app.scodoc import sco_edit_formation
|
from app.scodoc import sco_edit_formation
|
||||||
from app.scodoc import sco_edit_matiere
|
from app.scodoc import sco_edit_matiere
|
||||||
from app.scodoc import sco_edit_module
|
from app.scodoc import sco_edit_module
|
||||||
from app.scodoc import sco_edit_ue
|
from app.scodoc import sco_edit_ue
|
||||||
|
from app.scodoc import sco_exceptions
|
||||||
from app.scodoc import sco_formations
|
from app.scodoc import sco_formations
|
||||||
from app.scodoc import sco_formsemestre_edit
|
from app.scodoc import sco_formsemestre_edit
|
||||||
from app.scodoc import sco_moduleimpl
|
from app.scodoc import sco_moduleimpl
|
||||||
@ -273,31 +273,31 @@ def test_formations(test_client):
|
|||||||
|
|
||||||
# --- Suppression du module, matiere et ue test du semestre 2
|
# --- Suppression du module, matiere et ue test du semestre 2
|
||||||
|
|
||||||
# on doit d'abbord supprimer le semestre
|
# on doit d'abord supprimer le semestre:
|
||||||
|
|
||||||
# sco_formsemestre_edit.formsemestre_delete( formsemestre_id=sem2["formsemestre_id"])
|
|
||||||
# sco_formsemestre_edit.formsemestre_createwithmodules( formsemestre_id=sem2["formsemestre_id"])
|
|
||||||
|
|
||||||
# RIEN NE SE PASSE AVEC CES FONCTIONS
|
|
||||||
|
|
||||||
sco_formsemestre_edit.do_formsemestre_delete(
|
sco_formsemestre_edit.do_formsemestre_delete(
|
||||||
formsemestre_id=sem2["formsemestre_id"]
|
formsemestre_id=sem2["formsemestre_id"]
|
||||||
)
|
)
|
||||||
|
|
||||||
# sco_edit_module.module_delete( module_id=modt["module_id"])
|
|
||||||
# sco_edit_matiere.matiere_delete( matiere_id=matt["matiere_id"])
|
|
||||||
# sco_edit_ue.ue_delete( ue_id=uet["ue_id"])
|
|
||||||
|
|
||||||
# RIEN NE SE PASSE AVEC CES FONCTIONS
|
|
||||||
|
|
||||||
li_module = sco_edit_module.module_list()
|
li_module = sco_edit_module.module_list()
|
||||||
assert len(li_module) == 4
|
assert len(li_module) == 4
|
||||||
sco_edit_module.do_module_delete(oid=modt["module_id"]) # on supprime le semestre
|
# Suppression impossible car utilisé dans le semestre semt:
|
||||||
# sco_formsemestre_edit.formsemestre_delete_moduleimpls( formsemestre_id=sem2["formsemestre_id"], module_ids_to_del=[modt["module_id"]])
|
with pytest.raises(sco_exceptions.ScoNonEmptyFormationObject):
|
||||||
# deuxieme methode de supression d'un module
|
sco_edit_module.module_delete(module_id=mi3["module_id"])
|
||||||
li_module2 = sco_edit_module.module_list()
|
|
||||||
|
|
||||||
assert len(li_module2) == 3 # verification de la suppression du module
|
sco_formsemestre_edit.do_formsemestre_delete(semt["formsemestre_id"])
|
||||||
|
|
||||||
|
li_module2_before = sco_edit_module.module_list()
|
||||||
|
|
||||||
|
sco_edit_module.do_module_delete(mi3["module_id"])
|
||||||
|
sco_edit_module.do_module_delete(modt["module_id"])
|
||||||
|
|
||||||
|
# deuxieme methode de supression d'un module
|
||||||
|
li_module2_after = sco_edit_module.module_list()
|
||||||
|
|
||||||
|
assert (
|
||||||
|
len(li_module2_after) == len(li_module2_before) - 2
|
||||||
|
) # verification de la suppression
|
||||||
|
|
||||||
lim_sem2 = sco_moduleimpl.moduleimpl_list(formsemestre_id=sem2["formsemestre_id"])
|
lim_sem2 = sco_moduleimpl.moduleimpl_list(formsemestre_id=sem2["formsemestre_id"])
|
||||||
|
|
||||||
@ -316,10 +316,6 @@ def test_formations(test_client):
|
|||||||
assert len(li_ue2) == 3 # verification de la suppression de l'UE
|
assert len(li_ue2) == 3 # verification de la suppression de l'UE
|
||||||
|
|
||||||
# --- Suppression d'une formation
|
# --- Suppression d'une formation
|
||||||
# Il faut d'abbord supprimer le semestre aussi.
|
|
||||||
sco_formsemestre_edit.do_formsemestre_delete(
|
|
||||||
formsemestre_id=semt["formsemestre_id"]
|
|
||||||
)
|
|
||||||
|
|
||||||
sco_edit_formation.do_formation_delete(oid=f2["formation_id"])
|
sco_edit_formation.do_formation_delete(oid=f2["formation_id"])
|
||||||
lif3 = notes.formation_list(format="json").get_data(as_text=True)
|
lif3 = notes.formation_list(format="json").get_data(as_text=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user