def fake_get(url, stream): raw = MagicMock() src = io.BytesIO(file_content) raw.read = src.read res = FakeResponse(200, {}) res.raw = raw res.headers = {} return res
def fake_get(url, stream): raw = MagicMock() src = io.BytesIO(file_content) raw.read = src.read if url == web_url: raise UnauthorizedException() else: res = FakeResponse(200, {}) res.raw = raw res.headers = {'Content-Length': str(len(file_content))} return res