Example #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
Example #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
Example #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
Example #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