def test_run_with_send_request_raising_exception(session, mocker):
# exactly like the one above, but a different type of error is raised.
# this time, we have to set the state of socket to closed, thus forcing
# lomond to throw a non-socket error;
def return_fake_socket(self):
self.websocket.state.closed = True
return FakeSocket()
mocker.patch(
'lomond.session.WebsocketSession._connect', return_fake_socket)
_events = list(session.run())
assert isinstance(_events[-1], events.ConnectFail)
assert str(_events[-1]) == (
"ConnectFail('request error; data not sent')"
)
评论列表
文章目录