DispelEvilBot/tests/test_access_chat.py

24 lines
708 B
Python

"""Тесты фильтра чатов: бот игнорирует чужие группы."""
from __future__ import annotations
from bot.services.access import is_allowed_chat
def test_private_chat_is_allowed() -> None:
assert is_allowed_chat(123, "private", 100) is True
def test_main_chat_is_allowed() -> None:
assert is_allowed_chat(100, "supergroup", 100) is True
assert is_allowed_chat(100, "group", 100) is True
def test_foreign_group_is_ignored() -> None:
assert is_allowed_chat(200, "supergroup", 100) is False
assert is_allowed_chat(200, "group", 100) is False
def test_foreign_channel_is_ignored() -> None:
assert is_allowed_chat(200, "channel", 100) is False