Example #1
0
 def test_channel(self):
     msg = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                      'hello?')
     self.assertEqual(msg.channel(), '#bar')
     msg = IrcMessage('[email protected]', 'PRIVMSG',
                      '[email protected]', 'hello?')
     self.assertEqual(msg.channel(), None)
Example #2
0
 def test_publish_message(self):
     msg = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                      'hello?')
     self.vb.publish_message(msg)
     self.check([])
     [recvd_msg] = self.recvd_messages
     self.assertEqual(recvd_msg, msg)
Example #3
0
 def test_message(self):
     msg = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                      'hello?')
     self.assertEqual(msg.sender, 'user')
     self.assertEqual(msg.command, 'PRIVMSG')
     self.assertEqual(msg.recipient, '#bar')
     self.assertEqual(msg.content, 'hello?')
Example #4
0
 def test_action(self):
     sender, command, recipient, text = (self.nick, 'ACTION', "#zoo",
                                         "waves at zooites")
     self.vb.action(sender, recipient, text)
     [recvd_msg] = self.recvd_messages
     self.assertEqual(
         recvd_msg,
         IrcMessage(sender, command, recipient, text, self.vb.nickname))
Example #5
0
 def test_privmsg(self):
     sender, command, recipient, text = (self.nick, 'PRIVMSG', "#zoo",
                                         "Hello zooites")
     self.vb.privmsg(sender, recipient, text)
     [recvd_msg] = self.recvd_messages
     self.assertEqual(
         recvd_msg,
         IrcMessage(sender, command, recipient, text, self.vb.nickname))
Example #6
0
 def test_channel(self):
     msg = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                      'hello?')
     self.assertEqual(msg.channel(), '#bar')
     msg = IrcMessage('[email protected]', 'PRIVMSG',
                      '[email protected]', 'hello?')
     self.assertEqual(msg.channel(), None)
Example #7
0
 def test_inequality(self):
     msg1 = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                       'hello?')
     self.assertFalse(msg1 == object())
Example #8
0
 def test_equality(self):
     msg1 = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                       'hello?')
     msg2 = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                       'hello?')
     self.assertTrue(msg1 == msg2)
Example #9
0
 def test_addressed_to(self):
     msg = IrcMessage('[email protected]', 'PRIVMSG',
                      '[email protected]', 'hello?', 'nicktest')
     self.assertFalse(msg.addressed_to('user'))
     self.assertTrue(msg.addressed_to('otheruser'))
Example #10
0
 def test_nick(self):
     msg = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                      'hello?', 'nicktest')
     self.assertEqual(msg.nickname, 'nicktest')
Example #11
0
 def test_action(self):
     msg = IrcMessage('[email protected]', 'ACTION', '#bar',
                      'hello?')
     self.assertEqual(msg.command, 'ACTION')
Example #12
0
 def test_consume_message_action(self):
     self.vb.consume_message(
         IrcMessage('[email protected]', 'ACTION', '#bar', 'hello?'))
     self.check(["PRIVMSG #bar :\x01ACTION hello?\x01"])
Example #13
0
 def test_consume_message_privmsg(self):
     self.vb.consume_message(
         IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                    'hello?'))
     self.check(["PRIVMSG #bar :hello?"])
Example #14
0
 def test_addressed_to(self):
     msg = IrcMessage('[email protected]', 'PRIVMSG',
                      '[email protected]',
                      'hello?', 'nicktest')
     self.assertFalse(msg.addressed_to('user'))
     self.assertTrue(msg.addressed_to('otheruser'))