Beispiel #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()
Beispiel #2
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()