def test_close(self, mock_reactor): """ `close` invokes the request.finish method on the Twisted request. """ responder = Responder(Mock()) responder.close() mock_reactor.callFromThread.assert_called_once_with(responder.finish)
def test_exit(self): """ `__exit__` invokes the `close` method on the instance. """ responder = Responder(Mock()) responder.close = Mock() responder.__exit__(None, None, None) responder.close.assert_called_once_with()