Exemple #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)
Exemple #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)
Exemple #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?')
Exemple #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))
Exemple #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))
Exemple #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)
Exemple #7
0
 def test_inequality(self):
     msg1 = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                       'hello?')
     self.assertFalse(msg1 == object())
Exemple #8
0
 def test_equality(self):
     msg1 = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                       'hello?')
     msg2 = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                       'hello?')
     self.assertTrue(msg1 == msg2)
Exemple #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'))
Exemple #10
0
 def test_nick(self):
     msg = IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                      'hello?', 'nicktest')
     self.assertEqual(msg.nickname, 'nicktest')
Exemple #11
0
 def test_action(self):
     msg = IrcMessage('[email protected]', 'ACTION', '#bar',
                      'hello?')
     self.assertEqual(msg.command, 'ACTION')
Exemple #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"])
Exemple #13
0
 def test_consume_message_privmsg(self):
     self.vb.consume_message(
         IrcMessage('[email protected]', 'PRIVMSG', '#bar',
                    'hello?'))
     self.check(["PRIVMSG #bar :hello?"])
Exemple #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'))