Example #1
0
 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')
Example #2
0
 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())
Example #3
0
 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, [])
Example #4
0
 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")
Example #5
0
 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')
Example #6
0
 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"
     )
Example #7
0
 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"
     )
Example #8
0
 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"
     )
Example #9
0
 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, [])
Example #10
0
 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))
Example #11
0
 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)
Example #12
0
 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)
Example #13
0
 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)
Example #14
0
 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"
     ])
Example #15
0
 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)
     ])
Example #16
0
 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)
Example #17
0
 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, [])
Example #18
0
 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())   
Example #19
0
 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")
Example #20
0
 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")
Example #21
0
 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)
Example #22
0
 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'])
Example #23
0
 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)  
Example #24
0
 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')
Example #25
0
 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)
Example #26
0
 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)])
Example #27
0
 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")
Example #28
0
 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)
Example #29
0
 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())   
Example #30
0
 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"])
Example #31
0
 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")
Example #32
0
 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")
Example #33
0
 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")
Example #34
0
 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, [])
Example #35
0
 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))
Example #36
0
 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())
Example #37
0
 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')