pryscraper/tests/test_alerter.py
cryptorugmunch 8d25702eca chore(license): re-license to dual MIT (core) + BSL 1.1 (stealth)
Squashed from chore/license-relicense. Full message preserved in the
original branch commit bb77eb5. See ADR-0002 for the decision rationale.

Refs: ADR-0002, commit bb77eb5
2026-07-02 19:59:18 +02:00

51 lines
1.3 KiB
Python

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Rug Munch Media LLC
#
# Part of Pry — https://git.rugmunch.io/RugMunchMedia/pryscraper
# Licensed under MIT. See LICENSE.
"""Tests for multi-channel alerting."""
from alerter import (
_send_discord,
_send_slack,
_send_teams,
_send_telegram,
send_alert,
)
def test_send_alert_unknown_channel() -> None:
import asyncio
result = asyncio.run(send_alert("unknown", "Test", "Message", {}))
assert result["success"] is False
assert "unknown" in result["error"]
def test_send_slack_no_webhook() -> None:
import asyncio
result = asyncio.run(_send_slack("Test", "Message", {}, "info"))
assert result["success"] is False
def test_send_discord_no_webhook() -> None:
import asyncio
result = asyncio.run(_send_discord("Test", "Message", {}, "info"))
assert result["success"] is False
def test_send_teams_no_webhook() -> None:
import asyncio
result = asyncio.run(_send_teams("Test", "Message", {}, "info"))
assert result["success"] is False
def test_send_telegram_no_creds() -> None:
import asyncio
result = asyncio.run(_send_telegram("Test", "Message", {}, "info"))
assert result["success"] is False
assert "bot_token" in result["error"]