- return mock.patch('requests.put', side_effect=queue_with((
- fake_requests_response(code, body, **headers) for code in codes)))
+ m = mock.MagicMock()
+ if isinstance(body, tuple):
+ codes = list(codes)
+ codes.insert(0, body)
+ m.return_value.put.side_effect = queue_with((fake_requests_response(code, b, **headers) for b, code in codes))
+ else:
+ m.return_value.put.side_effect = queue_with((fake_requests_response(code, body, **headers) for code in codes))
+ return mock.patch('requests.Session', m)
+
+def mock_get_responses(body, *codes, **headers):
+ m = mock.MagicMock()
+ m.return_value.get.side_effect = queue_with((fake_requests_response(code, body, **headers) for code in codes))
+ return mock.patch('requests.Session', m)