Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
    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()