"""Adversarial tests: stored XSS, SSRF, auth on submissions, rate limits, moderation, no copying."""
import datetime as dt
import io
import json
import os
import socket
import sys
import tempfile
import threading
import unittest
import urllib.error
import urllib.request
from http.server import ThreadingHTTPServer
from unittest import mock
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from newsdigest import digest, moderate, render, safefetch, text, web # noqa: E402
from newsdigest.store import Store # noqa: E402
ARTICLE = ("
Acme ships open protocol for AI agents"
""
+ "Acme released an open protocol that lets AI agents discover each other and exchange tasks across vendors. " * 6
+ "
").encode()
XSS = '
">