Relecture : relance en échec, verrou, liste blanche, réponse invérifiable, étiquettes du contrat, clé hors LibreDesk, test d'instance local seulement
tests / tests (push) Failing after 1m5s
tests / tests (push) Failing after 1m5s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b48d756883
commit
d65e9b49d0
6 files changed
+77
-17
No files matched your search
+27
-2
@@ -3,7 +3,7 @@ from pathlib import Path
|
||||
|
||||
from support_diagnostic.diagnostic import Resultat
|
||||
from support_diagnostic.libredesk import Garde
|
||||
from support_diagnostic.run import Config, eligible, fil, note, traiter
|
||||
from support_diagnostic.run import ETIQUETTES, Config, eligible, fil, note, traiter
|
||||
|
||||
ENTETE = "<p><strong>🤖 BROUILLON IA — à relire, ne pas envoyer tel quel</strong></p>"
|
||||
MOI = 4
|
||||
@@ -29,7 +29,7 @@ class FauxLD:
|
||||
return MOI
|
||||
|
||||
def ids_etiquettes(self):
|
||||
return {"tri:diagnostic": 1}
|
||||
return {t: i for i, t in enumerate(ETIQUETTES)}
|
||||
|
||||
def conversations(self, avec):
|
||||
return [{"uuid": u} for u, t in self.tags.items() if "tri:diagnostic" in t]
|
||||
@@ -76,6 +76,11 @@ class TestConfig(unittest.TestCase):
|
||||
self.assertIsNone(cfg().autorisees)
|
||||
self.assertEqual(cfg(ALLOWED_CONVERSATION_IDS="c1, c2").autorisees, {"c1", "c2"})
|
||||
|
||||
def test_liste_blanche_mal_formee(self):
|
||||
for v in (",", " , ", ",,"):
|
||||
with self.assertRaises(ValueError, msg=v):
|
||||
cfg(ALLOWED_CONVERSATION_IDS=v)
|
||||
|
||||
def test_kill_switch(self):
|
||||
self.assertIsNone(Config.depuis_env({**ENV, "KILL_SWITCH": "1"}))
|
||||
for v in ("false", "0", ""):
|
||||
@@ -92,6 +97,7 @@ class TestCycle(unittest.TestCase):
|
||||
self.assertTrue(eligible(["tri:diagnostic", "diag:fait", "diag:relancer"]))
|
||||
self.assertFalse(eligible([]))
|
||||
self.assertFalse(eligible(["diag:relancer"]))
|
||||
self.assertFalse(eligible(["tri:diagnostic", "diag:fait", "diag:relancer", "diag:en-cours"]))
|
||||
|
||||
def test_plafond_et_liste_blanche(self):
|
||||
ld = FauxLD({f"c{i}": ["tri:diagnostic"] for i in range(1, 6)})
|
||||
@@ -136,6 +142,25 @@ class TestCycle(unittest.TestCase):
|
||||
self.assertEqual(sorted(ld.tags["c1"]), ["diag:erreur", "tri:diagnostic"])
|
||||
self.assertIn("RuntimeError", ld.notes[0][1])
|
||||
|
||||
def test_relance_en_echec_n_est_plus_eligible(self):
|
||||
ld = FauxLD({"c1": ["tri:diagnostic", "diag:fait", "diag:relancer"]})
|
||||
|
||||
def panne(*a):
|
||||
raise RuntimeError("agents en panne")
|
||||
traiter(ld, cfg(), panne)
|
||||
self.assertFalse(eligible(ld.tags["c1"]), ld.tags["c1"])
|
||||
ld = FauxLD({"c1": ["tri:diagnostic", "diag:fait", "diag:relancer"]}, note_leve=Garde("pas privée"))
|
||||
with self.assertRaises(Garde):
|
||||
traiter(ld, cfg(), diag_fait)
|
||||
self.assertFalse(eligible(ld.tags["c1"]), ld.tags["c1"])
|
||||
|
||||
def test_etiquettes_manquantes_arrete_avant_ecriture(self):
|
||||
ld = FauxLD({"c1": ["tri:diagnostic"]})
|
||||
ld.ids_etiquettes = lambda: {"tri:diagnostic": 1, "diag:en-cours": 2}
|
||||
with self.assertRaises(RuntimeError):
|
||||
traiter(ld, cfg(CONVERSATION="c1"), diag_fait)
|
||||
self.assertEqual((ld.notes, ld.tags["c1"], ld.lus), ([], ["tri:diagnostic"], []))
|
||||
|
||||
def test_garde_arrete_tout(self):
|
||||
ld = FauxLD({"c1": ["tri:diagnostic"], "c2": ["tri:diagnostic"]}, note_leve=Garde("pas privée"))
|
||||
with self.assertRaises(Garde):
|
||||
|
||||
Reference in new issue
Block a user