Esempio n. 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')
Esempio n. 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())
Esempio n. 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, [])
Esempio n. 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")
Esempio n. 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')
Esempio n. 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"
     )
Esempio n. 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"
     )
Esempio n. 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"
     )
Esempio n. 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, [])
Esempio n. 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))
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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"
     ])
Esempio n. 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)
     ])
Esempio n. 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)
Esempio n. 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, [])
Esempio n. 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())   
Esempio n. 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")
Esempio n. 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")
Esempio n. 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)
Esempio n. 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'])
Esempio n. 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)  
Esempio n. 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')
Esempio n. 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)
Esempio n. 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)])
Esempio n. 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")
Esempio n. 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)
Esempio n. 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())   
Esempio n. 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"])
Esempio n. 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")
Esempio n. 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")
Esempio n. 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")
Esempio n. 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, [])
Esempio n. 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))
Esempio n. 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())
Esempio n. 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')