def _AddMockJSONResponse(mock_client, url, response_dict):
 def _CreateResponse(request):
  return httpclient.HTTPResponse(request, 200, headers={'Content-Type': 'application/json'}, buffer=StringIO(json.dumps(response_dict)))
 mock_client.map(url, _CreateResponse)

def _AddMockJSONResponse ( mock_client , url , response_dict ) : def _CreateResponse ( request ) : return httpclient . HTTPResponse ( request , 200 , headers = { 'Content-Type' : 'application/json' } , buffer = StringIO ( json . dumps ( response_dict ) ) ) mock_client . map ( url , _CreateResponse )
add a mapping entry to the mock client such that requests to "url" will return an http response containing the json-formatted "response_dict" .