Пример #1
0
 def test_connection(self):
     host = Mock()
     conn = IRCConnection(host)
     conn.socket = self.fake_socket
     conn.start()
     conn.socket.connect_ex.assert_called_with(host)
     self.fake_socket.reset_mock()
Пример #2
0
 def testSendMsg(self):
     host = "useless"
     conn = IRCConnection(host)
     conn.socket = self.fake_socket
     outp = "test output\r\n"
     conn.send_msg(outp)
     conn.socket.send.assert_called_with(outp)
     self.fake_socket.reset_mock()
Пример #3
0
 def test_bind(self):
     host = "useless_stub"
     conn_ev, msg_ev = Mock(), Mock()
     conn = IRCConnection(host)
     conn.socket = self.fake_socket
     conn.bind_events(conn_ev, msg_ev)
     conn.start()
     self.assertTrue(conn_ev.called)
     conn.collect_incoming_data("PING test")
     conn.found_terminator()
     self.assertTrue(msg_ev.called)
     self.fake_socket.reset_mock()