- base_connaissances/ → snippets/ (corpus/ → textes/, instructions.md → consignes_redaction.md, decoupage.py → fichiers.py, importer.py → envoyer.py) ; python3 -m snippets.envoyer. - instance-de-test/ : 1_demarrer.sh, 2_creer_boite_et_cle.py, 3_brancher_ia.py, 4_essayer_brouillons.py, voir_empreintes.sh, connexion_admin.py. - ollama/verifier.py → ollama/verifier_ollama.py ; tests, tâches VS Code et docs alignés. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
1012 B
Python
24 lines
1012 B
Python
"""Le paquet snippets ne parle à LibreDesk que par les routes des extraits (design §2, plan Global Constraints)."""
|
|
import re
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
PAQUET = Path(__file__).resolve().parents[1] / "snippets"
|
|
AUTORISEES = {"/api/v1/ai/snippets", "/api/v1/ai/snippets/{id}"} # la route PUT s'écrit f"/api/v1/ai/snippets/{id}"
|
|
|
|
|
|
class TestGardeFouBase(unittest.TestCase):
|
|
def test_seules_les_routes_des_extraits(self):
|
|
for f in PAQUET.glob("*.py"):
|
|
texte = f.read_text()
|
|
self.assertEqual(set(re.findall(r"/api/v1/[a-z0-9_/{}-]+", texte)) - AUTORISEES, set(), f.name)
|
|
for interdit in ("/messages", "/conversations", "DELETE", "automations", "assistants"):
|
|
self.assertNotIn(interdit, texte, f"{interdit} dans {f.name}")
|
|
|
|
def test_le_paquet_a_bien_un_client(self): # sans envoyer.py, le test ci-dessus passerait à vide
|
|
self.assertTrue((PAQUET / "envoyer.py").exists())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|