Ejemplo n.º 1
0
def handler():
    default = binding.handler()
    def request(url, message, **kwargs):
        response = default(url, message, **kwargs)
        print "%s %s => %d (%s)" % (
            message['method'], url, response['status'], response['reason'])
        return response
    return request
Ejemplo n.º 2
0
    def test(self):
        global opts

        paths = [
            "/services", 
            "authentication/users", 
            "search/jobs"
        ]

        handlers = [
            binding.handler(),  # default handler
            urllib2_handler,
        ]

        for handler in handlers:
            context = binding.connect(handler=handler, **opts.kwargs)
            for path in paths:
                body = context.get(path).body.read()
                self.assertTrue(isatom(body))