Poller: the LibreDesk conversations into Supabase, one run or in a loop (read-only on LibreDesk)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b0b7e3411d
commit
271c230635
5 files changed
+403
No files matched your search
@@ -0,0 +1,26 @@
|
||||
"""The poller reads LibreDesk only through conversations.pomper.Lecteur (GET only) and writes only to Supabase."""
|
||||
import re
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from poller.poll import Supabase
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class TestGuardPoller(unittest.TestCase):
|
||||
def test_never_a_libredesk_route(self):
|
||||
files = list((ROOT / "poller").glob("*.py"))
|
||||
self.assertTrue(files)
|
||||
for f in files:
|
||||
self.assertNotIn("/api/v1/", f.read_text(), f.name)
|
||||
|
||||
def test_writes_only_to_supabase(self):
|
||||
text = (ROOT / "poller" / "poll.py").read_text()
|
||||
self.assertEqual(set(re.findall(r'"(/[a-z]+/v1/)', text)) - {"/rest/v1/", "/storage/v1/"}, set())
|
||||
with self.assertRaises(ValueError):
|
||||
Supabase("http://x", "k")._request("POST", "/api/v1/conversations", b"")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user