Ejemplo n.º 1
0
    def got_auth((token, catalog)):
        request_ = add_headers(otter_headers(token), request)
        request_ = add_effect_on_response(invalidate_eff, service_request.reauth_codes, request_)
        request_ = add_json_request_data(request_)
        if "url" in service_config:
            request_ = add_bind_root(service_config["url"], request_)
        else:
            request_ = add_bind_service(catalog, service_name, region, log, request_)
        request_ = add_error_handling(service_request.success_pred, request_)
        if service_request.json_response:
            request_ = add_json_response(request_)

        return request_(
            service_request.method,
            service_request.url,
            headers=service_request.headers,
            data=service_request.data,
            params=service_request.params,
            log=log,
        )
Ejemplo n.º 2
0
    def got_auth((token, catalog)):
        request_ = add_headers(otter_headers(token), request)
        request_ = add_effect_on_response(invalidate_eff,
                                          service_request.reauth_codes,
                                          request_)
        request_ = add_json_request_data(request_)
        if 'url' in service_config:
            request_ = add_bind_root(service_config['url'], request_)
        else:
            request_ = add_bind_service(catalog, service_name, region, log,
                                        request_)
        request_ = add_error_handling(service_request.success_pred, request_)
        if service_request.json_response:
            request_ = add_json_response(request_)

        return request_(service_request.method,
                        service_request.url,
                        headers=service_request.headers,
                        data=service_request.data,
                        params=service_request.params,
                        log=log)
Ejemplo n.º 3
0
 def test_add_json_request_data(self):
     """The produced request function serializes data to json."""
     eff = add_json_request_data(request)('m', 'u', data={'a': 'b'})
     self.assertEqual(eff.intent.data, json.dumps({'a': 'b'}))
Ejemplo n.º 4
0
 def test_add_json_request_data(self):
     """The produced request function serializes data to json."""
     eff = add_json_request_data(request)('m', 'u', data={'a': 'b'})
     self.assertEqual(eff.intent.data, json.dumps({'a': 'b'}))