Exemplo n.º 1
0
 def test_fatal_error(self):
     config = mock.Mock()
     config.mode.get_upstream_server.side_effect = RuntimeError
     c = ConnectionHandler(config, mock.MagicMock(), ("127.0.0.1", 8080),
                           None, mock.MagicMock())
     with tutils.capture_stderr(c.handle) as output:
         assert "mitmproxy has crashed" in output
Exemplo n.º 2
0
 def test_fatal_error(self):
     config = mock.Mock()
     config.mode.get_upstream_server.side_effect = RuntimeError
     c = ConnectionHandler(
         config,
         mock.MagicMock(),
         ("127.0.0.1",
          8080),
         None,
         mock.MagicMock())
     with tutils.capture_stderr(c.handle) as output:
         assert "mitmproxy has crashed" in output
Exemplo n.º 3
0
    def test_fatal_error(self):
        config = mock.Mock()
        root_layer = mock.Mock()
        root_layer.side_effect = RuntimeError
        config.mode.return_value = root_layer
        channel = mock.Mock()

        def ask(_, x):
            return x

        channel.ask = ask
        c = ConnectionHandler(mock.MagicMock(), ("127.0.0.1", 8080), config, channel)
        with tutils.capture_stderr(c.handle) as output:
            assert "mitmproxy has crashed" in output
Exemplo n.º 4
0
    def test_fatal_error(self):
        config = mock.Mock()
        root_layer = mock.Mock()
        root_layer.side_effect = RuntimeError
        config.mode.return_value = root_layer
        channel = mock.Mock()

        def ask(_, x):
            return x

        channel.ask = ask
        c = ConnectionHandler(mock.MagicMock(), ("127.0.0.1", 8080), config,
                              channel)
        with tutils.capture_stderr(c.handle) as output:
            assert "mitmproxy has crashed" in output