Actually it raises an interesitng question of use. Given:
def callback(request, context): resp = requests.get('http://example.com') context.status_code = resp.status_code return resp.text
with requests_mock.Mocker(real_http=True) as mock: mock.post('http://foo.org', text=callback) mock.get('http://example.com', text='abc')
print requests.post('http://foo.org')
would we expect the request made in callback() to trigger the mock created at the higher level? I guess so, but it's an odd case.
Actually it raises an interesitng question of use. Given:
def callback(request, context): example. com') status_ code = resp.status_code
resp = requests.get('http://
context.
return resp.text
with requests_ mock.Mocker( real_http= True) as mock: foo.org', text=callback) example. com', text='abc')
mock.post('http://
mock.get('http://
print requests.post('http:// foo.org')
would we expect the request made in callback() to trigger the mock created at the higher level? I guess so, but it's an odd case.