I'm creating a unit test making sure my http client is passing auth token correctly. I'm using requests_mock lib
with requests_mock.mock() as m:
m.get(
"https://my-endpoint",
text="{}",
)
history = m.request_history[0]
assert "Bearer test" == history._request.headers.get("Authorization")
But history._request is a protected member so I'd like to avoid binding to protected members in my code. Is there some more proper way to check Authorization header in requests_mock ?