Rewrite test_double_connection.

This caused various problems in the old form.
This commit is contained in:
Florian Bruhin 2015-09-03 06:38:35 +02:00
parent f4d2e0746e
commit 46b28387db

View File

@ -228,6 +228,13 @@ class TestHandleConnection:
record = caplog.records()[0]
assert record.message == "No new connection to handle."
def test_double_connection(self, qlocalsocket, ipc_server, caplog):
ipc_server._socket = qlocalsocket
ipc_server.handle_connection()
message = ("Got new connection but ignoring it because we're still "
"handling another one.")
assert message in [rec.message for rec in caplog.records()]
def test_disconnected_immediately(self, ipc_server, caplog):
socket = FakeSocket(state=QLocalSocket.UnconnectedState)
ipc_server._server = FakeServer(socket)
@ -298,19 +305,6 @@ def test_normal(qtbot, tmpdir, ipc_server, mocker, has_cwd):
assert spy[0] == [['foo'], expected_cwd]
def test_double_connection(qtbot, connected_socket, ipc_server, caplog):
spy = QSignalSpy(ipc_server.got_args)
error_spy = QSignalSpy(ipc_server.got_invalid_data)
with qtbot.waitSignal(ipc_server._server.newConnection, raising=True):
sent = ipc.send_to_running_instance('qutebrowser-test', [])
assert sent
assert not spy
assert not error_spy
message = ("Got new connection but ignoring it because we're still "
"handling another one.")
assert message in [rec.message for rec in caplog.records()]
def test_disconnected_without_data(qtbot, connected_socket,
ipc_server, caplog):
"""Disconnect without sending data.