30 lines
685 B
Python
30 lines
685 B
Python
#!/usr/bin/env python
|
|
|
|
import unittest
|
|
from unittest.mock import Mock
|
|
import os
|
|
import re
|
|
import sys
|
|
fakes_dir = os.path.join(os.path.dirname(__file__), 'fakes')
|
|
assert(os.path.exists(fakes_dir))
|
|
sys.path.insert(0, fakes_dir)
|
|
import autobanbot
|
|
|
|
CHAT_ID = "Chat ID"
|
|
USER_ID = "User ID"
|
|
MESSAGE_ID = "Message ID"
|
|
BOT_SPEC = ["kick_chat_member", "delete_message"]
|
|
|
|
|
|
class TestAutoBanBot(unittest.IsolatedAsyncioTestCase):
|
|
def setUp(self):
|
|
self.regexes = map(lambda r: re.compile(r, re.I), ["test123", "(t\.me\/|\@)[a-z]+bot"])
|
|
|
|
async def test_not_bannable(self):
|
|
await autobanbot.new_msg(None, None, self.regexes)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|
|
|