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 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()

