self.assertEqual(newbot.ircsock.sent_message,"PRIVMSG #openhatch-bots :Welcome Hermione! The channel is pretty quiet right now, so I though I'd say hello, and ping some people (like shauna) that you're here. If no one responds for a while, try emailing us at hello@openhatch.org or just try coming back later. FYI, you're now on my list of known nicknames, so I won't bother you again.\n")
newbot.message_response(self.bot,"~q@r.m.us PRIVMSG #openhatch-bots :hah","Chappe")# Standard message by newcomer
nicklist=[i.nickforiinself.bot.newcomers]# Makes a list of newcomers nicks for easy asserting
self.assertEqual(nicklist,['Chappe'])
deftest_oldtimer_speaking(self):
newbot.message_response(self.bot,"~q@r.m.us PRIVMSG #openhatch-bots :hah","Alice")# Standard message by oldtimer
nicklist=[i.nickforiinself.bot.newcomers]# Makes a list of newcomers nicks for easy asserting
self.assertEqual(nicklist,[])
deftest_join(self):
newbot.message_response(self.bot,"JOIN #openhatch-bots right now!","Shauna")# 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
newbot.message_response(self.bot,"JOIN #openhatch-bots right now!","Shauna")# 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)
newbot.message_response(self.bot,"PART #openhatch-bots","Shauna")# Replace with actual ping message ALSO argh the channel variable might mess things up :/
self.assertEqual(len(self.bot.newcomers),1)
deftest_hello(self):
newbot.fake_irc_start()
newbot.message_response(self.bot,"PRIVMSG sup WelcomeBot2","Shauna")# The botnick may also be changed. :(
self.assertTrue(hasattr(newbot.ircsock,'sent_message'))# Fails because sent_message is never actually created
newbot.message_response(self.bot,"PRIVMSG info WelcomeBot2","Shauna")# The botnick may also be changed. :(
self.assertTrue(hasattr(newbot.ircsock,'sent_message'))# Fails because sent_message is never actually created
self.assertEqual(newbot.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")
deftest_wait_time_from_admin(self):
newbot.fake_irc_start()
newbot.message_response(self.bot,"WelcomeBot2 --wait-time 40","shauna")# Channel-greeters may also be changed. :(
self.assertEqual(newbot.ircsock.sent_message,"PRIVMSG #openhatch-bots :shauna the wait time is changing to 40 seconds.\n")
deftest_wait_time_from_non_admin(self):
newbot.fake_irc_start()
newbot.message_response(self.bot,"WelcomeBot2 --wait-time 40","Impostor")# Channel-greeters may also be changed. :(
self.assertEqual(newbot.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")
deftest_pong(self):
newbot.fake_irc_start()
newbot.message_response(self.bot,"PING :","Shauna")# Replace this with actual ping message