Client LibreDesk restreint : notes privées et étiquettes seulement
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5e3faa47b4
commit
35a9bae018
5 files changed
+250
No files matched your search
@@ -0,0 +1,34 @@
|
||||
"""Spec §7.10 : le seul envoi vers …/messages est la note privée, private en dur, sans destinataires."""
|
||||
import ast
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
PAQUET = Path(__file__).resolve().parents[1] / "support_diagnostic"
|
||||
|
||||
|
||||
class TestGardeFou(unittest.TestCase):
|
||||
def sources(self):
|
||||
return {f.name: f.read_text() for f in PAQUET.glob("*.py")}
|
||||
|
||||
def test_un_seul_post_de_messages(self):
|
||||
sources = self.sources()
|
||||
for nom, texte in sources.items():
|
||||
if nom != "libredesk.py":
|
||||
self.assertNotIn("/messages", texte, nom)
|
||||
arbre = ast.parse(sources["libredesk.py"])
|
||||
fonctions = {f.name for f in ast.walk(arbre) if isinstance(f, ast.FunctionDef)
|
||||
and "/messages" in ast.get_source_segment(sources["libredesk.py"], f)}
|
||||
self.assertEqual(fonctions, {"note_privee", "messages"})
|
||||
messages = next(f for f in ast.walk(arbre) if isinstance(f, ast.FunctionDef) and f.name == "messages")
|
||||
self.assertNotIn("POST", ast.get_source_segment(sources["libredesk.py"], messages))
|
||||
|
||||
def test_private_en_dur(self):
|
||||
sources = self.sources()
|
||||
self.assertIn('"private": True', sources["libredesk.py"])
|
||||
for nom, texte in sources.items():
|
||||
for interdit in ('"to"', '"cc"', '"bcc"', "set_tags"):
|
||||
self.assertNotIn(interdit, texte, f"{interdit} dans {nom}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user