Praxis_Bot/tests/test_twitch_script_class.py
dtookey 17e1a092be updated tts.py
support both gtts and aws polly (we borrow from the streamlabs api)
moved some configuration stuff around
added one test method for creating file names, but it doesn't have any assertions, so it's useless
added enums for different configuration properties like tts engine, file naming, and poly voices
2020-09-20 13:35:53 -04:00

36 lines
1.1 KiB
Python

import unittest
import twitch_script_class
import twitch
testValidUrls = ['https://shady.ru', 'http://stolencards.zn', 'https://i.imgur.com/FL6slHd.jpg']
testInvalidUrls = ['this is just a sentence. With a period', 'gotta have some other stuff', 'bad punctuation.does not produces false positives']
class TwitchBotTest(unittest.TestCase):
def setUp(self):
self.bot = twitch_script_class.Twitch_Module()
def test_find_url(self):
bot = self.bot
for link in testInvalidUrls:
msg = twitch.chat.Message("", "", link)
t = bot.contains_url(msg)
assert not t
for link in testValidUrls:
msg = twitch.chat.Message("", "", link)
t = bot.contains_url(msg)
assert t
def test_find_slur(self):
nonSlurMessage = twitch.chat.Message("", "", "hey look, a normal sentence")
slurMessage = twitch.chat.Message("", "", "fag is a hateful word that shouldn't be used anymore")
assert not self.bot.contains_slur(nonSlurMessage)
assert self.bot.contains_slur(slurMessage)
if __name__ == '__main__':
unittest.main()