Add webhook text length stuff
Some checks failed
Test and build Docker image / docker (push) Failing after 15s

This commit is contained in:
Joakim Hellsén 2026-07-02 04:40:38 +02:00
commit 85f25263f3
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
9 changed files with 525 additions and 26 deletions

View file

@ -508,6 +508,26 @@ def test_post_set_global_screenshot_layout_triggers_backup(monkeypatch: pytest.M
assert "Set global screenshot layout to mobile" in commit_message
def test_post_set_global_webhook_text_length_limit_triggers_backup(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
"""Posting to /set_global_webhook_text_length_limit should trigger a git backup."""
backup_path: Path = tmp_path / "backup"
monkeypatch.setenv("GIT_BACKUP_PATH", str(backup_path))
monkeypatch.delenv("GIT_BACKUP_REMOTE", raising=False)
with patch("discord_rss_bot.main.commit_state_change") as mock_commit:
response = client.post(url="/set_global_webhook_text_length_limit", data={"text_length_limit": "2500"})
assert response.status_code == 200, f"Failed to set global webhook text length limit: {response.text}"
mock_commit.assert_called_once()
call_args = mock_commit.call_args
assert call_args is not None
commit_message: str = call_args[0][1]
assert "Set global webhook text length limit to 2500" in commit_message
def test_post_custom_message_triggers_backup(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
"""Posting to /custom should trigger a git backup."""
backup_path: Path = tmp_path / "backup"