Add domain-wide blacklist and whitelist functionality
This commit is contained in:
parent
aa8a74ba67
commit
bdbd46ebd4
14 changed files with 930 additions and 305 deletions
|
|
@ -173,9 +173,11 @@ def test_export_state_creates_state_json(tmp_path: Path) -> None:
|
|||
tag: str | None = None,
|
||||
default: str | None = None,
|
||||
) -> list[Any] | str | None:
|
||||
if feed_or_key == () and tag is None:
|
||||
# Called for global webhooks list
|
||||
return []
|
||||
if feed_or_key == () and tag == "domain_blacklist":
|
||||
return {"example.com": {"blacklist_title": "spoiler"}}
|
||||
|
||||
if feed_or_key == () and tag == "domain_whitelist":
|
||||
return {"example.com": {"whitelist_title": "release"}}
|
||||
|
||||
if tag == "webhook":
|
||||
return "https://discord.com/api/webhooks/123/abc"
|
||||
|
|
@ -194,6 +196,8 @@ def test_export_state_creates_state_json(tmp_path: Path) -> None:
|
|||
data: dict[str, Any] = json.loads(state_file.read_text(encoding="utf-8"))
|
||||
assert "feeds" in data
|
||||
assert "webhooks" in data
|
||||
assert data["domain_blacklist"]["example.com"]["blacklist_title"] == "spoiler"
|
||||
assert data["domain_whitelist"]["example.com"]["whitelist_title"] == "release"
|
||||
assert data["feeds"][0]["url"] == "https://example.com/feed.rss"
|
||||
assert data["feeds"][0]["webhook"] == "https://discord.com/api/webhooks/123/abc"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue