예제 #1
0
    def test_ping(self):
        """Respond to PING with PONG."""
        client = mock.MagicMock()
        message = ReceivedMessage(b'PING :hostname.example.com')

        handlers.ping(client, message)

        client.connection.send.assert_called_with(b'PONG :hostname.example.com\r\n')
예제 #2
0
    def test_other(self):
        """Do not respond to other commands."""
        client = mock.MagicMock()
        message = ReceivedMessage(b'DERP :hostname.example.com')

        handlers.ping(client, message)

        self.assertFalse(client.connection.send.called)