def test_join(self): botcode.message_response( self.bot, "JOIN #openhatch-bots right now!", "Shauna", ircsock=self.ircsock ) # Replace with actual ping message ALSO argh the channel variable might mess things up if folks change it, which they very well might :/ (Also true for tests below.) I think maybe use the format.() style that is used for wait_change etc self.assertEqual(self.bot.newcomers[1].nick, 'Shauna')
def test_bad_pong(self): botcode.message_response(self.bot, "PING!!! :", "Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters ) # Replace this with actual ping message self.assertFalse(self.ircsock.has_sent_message())
def test_oldtimer_speaking(self): botcode.message_response( self.bot, "[email protected] PRIVMSG #openhatch-bots :hah", "Alice", ircsock=self.ircsock) # Standard message by oldtimer nicklist = [i.nick for i in self.bot.newcomers ] # Makes a list of newcomers nicks for easy asserting self.assertEqual(nicklist, [])
def test_pong(self): botcode.message_response(self.bot, "PING :", "Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters ) # Replace this with actual ping message self.assertEqual(self.ircsock.sent_message(), "PONG :\n")
def test_join(self): botcode.message_response(self.bot, "JOIN {} right now!".format(settings.channel), "Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters ) # Replace with actual ping message self.assertEqual(self.bot.newcomers[1].nick, 'Shauna')
def test_wait_time_from_non_admin(self): botcode.message_response( self.bot, "WelcomeBot2 --wait-time 40", "Impostor", ircsock=self.ircsock) # Channel-greeters may also be changed. :( self.assertEqual( self.ircsock.sent_message(), "PRIVMSG #openhatch-bots :Impostor you are not authorized to make that change. Please contact one of the channel greeters, like shauna, for assistance.\n" )
def test_wait_time_from_admin(self): botcode.message_response( self.bot, "WelcomeBot2 --wait-time 40", "shauna", ircsock=self.ircsock) # Channel-greeters may also be changed. :( self.assertEqual( self.ircsock.sent_message(), "PRIVMSG #openhatch-bots :shauna the wait time is changing to 40 seconds.\n" )
def test_help(self): botcode.message_response( self.bot, "PRIVMSG info WelcomeBot2", "Shauna", ircsock=self.ircsock) # The botnick may also be changed. :( self.assertTrue(self.ircsock.has_sent_message()) self.assertEqual( self.ircsock.sent_message(), "PRIVMSG #openhatch-bots :I'm a bot! I'm from here <https://github.com/shaunagm/oh-irc-bot>. You can change my behavior by submitting a pull request or by talking to shauna.\n" )
def test_oldtimer_speaking(self): botcode.message_response( self.bot, "[email protected] PRIVMSG {} :hah".format(settings.channel), "Alice", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Standard message by oldtimer nicklist = [i.nick for i in self.bot.newcomers ] # Makes a list of newcomers nicks for easy asserting self.assertEqual(nicklist, [])
def test_help(self): botcode.message_response(self.bot, "PRIVMSG info {}".format(self.bot.botnick), "Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) self.assertTrue(self.ircsock.has_sent_message()) self.assertEqual( self.ircsock.sent_message(), "PRIVMSG {} :I'm a bot! I'm from here <https://github.com/shaunagm/oh-irc-bot>. You can change my behavior by submitting a pull request or by talking to shauna.\n" .format(settings.channel))
def test_part(self): botcode.message_response( self.bot, "JOIN #openhatch-bots right now!", "Shauna", ircsock=self.ircsock ) # Replace with actual ping message ALSO argh the channel variable might mess things up if folks change it, which they very well might :/ (Also true for tests below.) self.assertEqual(len(self.bot.newcomers), 2) botcode.message_response( self.bot, "PART #openhatch-bots", "Shauna", ircsock=self.ircsock ) # Replace with actual ping message ALSO argh the channel variable might mess things up :/ self.assertEqual(len(self.bot.newcomers), 1)
def test_wait_time_from_admin(self): botcode.message_response(self.bot, "{} --wait-time 40".format(self.bot.botnick), "shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters ) # Channel-greeters may also be changed. :( self.assertEqual( self.ircsock.sent_message(), "PRIVMSG {} :shauna the wait time is changing to 40 seconds.\n". format(settings.channel)) self.assertEqual(self.bot.wait_time, 40)
def test_wait_time_from_non_admin(self): botcode.message_response(self.bot, "{} --wait-time 40".format(self.bot.botnick), "Impostor", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters ) # Channel-greeters may also be changed. :( self.assertEqual( self.ircsock.sent_message(), "PRIVMSG {0} :Impostor you are not authorized to make that change. Please contact one of the channel greeters, like {1}, for assistance.\n" .format(settings.channel, botcode.greeter_string(settings.channel_greeters))) self.assertEqual(self.bot.wait_time, settings.wait_time)
def test_hello(self): botcode.message_response( self.bot, "PRIVMSG sup WelcomeBot2", "Shauna", ircsock=self.ircsock) # The botnick may also be changed. :( self.assertTrue(self.ircsock.has_sent_message()) self.assertIn(self.ircsock.sent_message(), [ "PRIVMSG #openhatch-bots :hello Shauna\n", "PRIVMSG #openhatch-bots :hi Shauna\n", "PRIVMSG #openhatch-bots :hey Shauna\n", "PRIVMSG #openhatch-bots :yo Shauna\n", "PRIVMSG #openhatch-bots :sup Shauna\n" ])
def test_hello(self): botcode.message_response(self.bot, "PRIVMSG sup {}".format(self.bot.botnick), "Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) self.assertTrue(self.ircsock.has_sent_message()) self.assertIn(self.ircsock.sent_message(), [ "PRIVMSG {} :hello Shauna\n".format(settings.channel), "PRIVMSG {} :hi Shauna\n".format(settings.channel), "PRIVMSG {} :hey Shauna\n".format(settings.channel), "PRIVMSG {} :yo Shauna\n".format(settings.channel), "PRIVMSG {} :sup Shauna\n".format(settings.channel) ])
def test_part(self): botcode.message_response(self.bot, "JOIN {} right now!".format(settings.channel), "Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters ) # Replace with actual ping message self.assertEqual(len(self.bot.newcomers), 2) botcode.message_response(self.bot, "PART {}".format(settings.channel), "Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters ) # Replace with actual ping message self.assertEqual(len(self.bot.newcomers), 1)
def test_oldtimer_speaking(self): botcode.message_response(self.bot,"[email protected] PRIVMSG {} :hah".format(settings.channel),"Alice", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Standard message by oldtimer nicklist = [i.nick for i in self.bot.newcomers] # Makes a list of newcomers nicks for easy asserting self.assertEqual(nicklist, [])
def test_bad_pong(self): botcode.message_response(self.bot,"PING!!! :","Shauna",ircsock=self.ircsock) # Replace this with actual ping message self.assertFalse(self.ircsock.has_sent_message())
def test_pong(self): botcode.message_response(self.bot,"PING :","Shauna",ircsock=self.ircsock) # Replace this with actual ping message self.assertEqual(self.ircsock.sent_message(),"PONG :pingis\n")
def test_wait_time_from_non_admin(self): botcode.message_response(self.bot,"WelcomeBot2 --wait-time 40","Impostor",ircsock=self.ircsock) # Channel-greeters may also be changed. :( self.assertEqual(self.ircsock.sent_message(), "PRIVMSG #openhatch-bots :Impostor you are not authorized to make that change. Please contact one of the channel greeters, like shauna, for assistance.\n")
def test_wait_time_from_admin(self): botcode.message_response(self.bot,"{} --wait-time 40".format(self.bot.botnick),"shauna",ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Channel-greeters may also be changed. :( self.assertEqual(self.ircsock.sent_message(), "PRIVMSG {} :shauna the wait time is changing to 40 seconds.\n".format(settings.channel)) self.assertEqual(self.bot.wait_time, 40)
def test_newcomer_speaking(self): botcode.message_response(self.bot,"[email protected] PRIVMSG {} :hah".format(botcode.channel),"Chappe", ircsock=self.ircsock) # Standard message by newcomer nicklist = [i.nick for i in self.bot.newcomers] # Makes a list of newcomers nicks for easy asserting self.assertEqual(nicklist, ['Chappe'])
def test_part(self): botcode.message_response(self.bot,"JOIN #openhatch-bots right now!","Shauna", ircsock=self.ircsock) # Replace with actual ping message ALSO argh the channel variable might mess things up if folks change it, which they very well might :/ (Also true for tests below.) self.assertEqual(len(self.bot.newcomers), 2) botcode.message_response(self.bot,"PART #openhatch-bots","Shauna", ircsock=self.ircsock) # Replace with actual ping message ALSO argh the channel variable might mess things up :/ self.assertEqual(len(self.bot.newcomers), 1)
def test_join(self): botcode.message_response(self.bot,"JOIN {} right now!".format(settings.channel),"Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Replace with actual ping message self.assertEqual(self.bot.newcomers[1].nick,'Shauna')
def test_part(self): botcode.message_response(self.bot,"JOIN {} right now!".format(settings.channel),"Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Replace with actual ping message self.assertEqual(len(self.bot.newcomers), 2) botcode.message_response(self.bot,"PART {}".format(settings.channel),"Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Replace with actual ping message self.assertEqual(len(self.bot.newcomers), 1)
def test_hello(self): botcode.message_response(self.bot,"PRIVMSG sup {}".format(self.bot.botnick),"Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) self.assertTrue(self.ircsock.has_sent_message()) self.assertIn(self.ircsock.sent_message(), ["PRIVMSG {} :hello Shauna\n".format(settings.channel), "PRIVMSG {} :hi Shauna\n".format(settings.channel), "PRIVMSG {} :hey Shauna\n".format(settings.channel), "PRIVMSG {} :yo Shauna\n".format(settings.channel), "PRIVMSG {} :sup Shauna\n".format(settings.channel)])
def test_pong(self): botcode.message_response(self.bot,"PING :","Shauna",ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Replace this with actual ping message self.assertEqual(self.ircsock.sent_message(),"PONG :\n")
def test_wait_time_from_non_admin(self): botcode.message_response(self.bot,"{} --wait-time 40".format(self.bot.botnick),"Impostor",ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Channel-greeters may also be changed. :( self.assertEqual(self.ircsock.sent_message(), "PRIVMSG {0} :Impostor you are not authorized to make that change. Please contact one of the channel greeters, like {1}, for assistance.\n".format(settings.channel,botcode.greeter_string(settings.channel_greeters))) self.assertEqual(self.bot.wait_time, settings.wait_time)
def test_hello(self): botcode.message_response(self.bot,"PRIVMSG sup WelcomeBot2","Shauna", ircsock=self.ircsock) # The botnick may also be changed. :( self.assertTrue(self.ircsock.has_sent_message()) self.assertIn(self.ircsock.sent_message(), ["PRIVMSG #openhatch-bots :hello Shauna\n", "PRIVMSG #openhatch-bots :hi Shauna\n", "PRIVMSG #openhatch-bots :hey Shauna\n", "PRIVMSG #openhatch-bots :yo Shauna\n", "PRIVMSG #openhatch-bots :sup Shauna\n"])
def test_help(self): botcode.message_response(self.bot,"PRIVMSG info WelcomeBot2","Shauna", ircsock=self.ircsock) # The botnick may also be changed. :( self.assertTrue(self.ircsock.has_sent_message()) self.assertEqual(self.ircsock.sent_message(), "PRIVMSG #openhatch-bots :I'm a bot! I'm from here <https://github.com/shaunagm/oh-irc-bot>. You can change my behavior by submitting a pull request or by talking to shauna.\n")
def test_wait_time_from_admin(self): botcode.message_response(self.bot,"WelcomeBot2 --wait-time 40","shauna",ircsock=self.ircsock) # Channel-greeters may also be changed. :( self.assertEqual(self.ircsock.sent_message(), "PRIVMSG #openhatch-bots :shauna the wait time is changing to 40 seconds.\n")
def test_oldtimer_speaking(self): botcode.message_response(self.bot,"[email protected] PRIVMSG #openhatch-bots :hah","Alice", ircsock=self.ircsock) # Standard message by oldtimer nicklist = [i.nick for i in self.bot.newcomers] # Makes a list of newcomers nicks for easy asserting self.assertEqual(nicklist, [])
def test_help(self): botcode.message_response(self.bot,"PRIVMSG info {}".format(self.bot.botnick),"Shauna", ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) self.assertTrue(self.ircsock.has_sent_message()) self.assertEqual(self.ircsock.sent_message(), "PRIVMSG {} :I'm a bot! I'm from here <https://github.com/shaunagm/oh-irc-bot>. You can change my behavior by submitting a pull request or by talking to shauna.\n".format(settings.channel))
def test_bad_pong(self): botcode.message_response(self.bot,"PING!!! :","Shauna",ircsock=self.ircsock, channel=settings.channel, greeters=settings.channel_greeters) # Replace this with actual ping message self.assertFalse(self.ircsock.has_sent_message())
def test_join(self): botcode.message_response(self.bot,"JOIN #openhatch-bots right now!","Shauna", ircsock=self.ircsock) # Replace with actual ping message ALSO argh the channel variable might mess things up if folks change it, which they very well might :/ (Also true for tests below.) I think maybe use the format.() style that is used for wait_change etc self.assertEqual(self.bot.newcomers[1].nick,'Shauna')