auto-ban-bot/tests.py

30 lines
685 B
Python
Raw Normal View History

2018-07-24 13:31:04 +00:00
#!/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)
2018-07-24 13:31:04 +00:00
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):
2018-07-24 13:31:04 +00:00
def setUp(self):
self.regexes = map(lambda r: re.compile(r, re.I), ["test123", "(t\.me\/|\@)[a-z]+bot"])
2018-07-24 13:31:04 +00:00
async def test_not_bannable(self):
await autobanbot.new_msg(None, None, self.regexes)
2018-07-24 13:31:04 +00:00
if __name__ == '__main__':
unittest.main()