In on of my view tests, I tried to make a simple get request that requires Basic Auth using a client:
staff_credentials = base64.b64encode(b'staff_user:staff_password').decode('utf-8')
response = client.get(url, headers={
"Authorization": f"Basic {staff_credentials}"
})
assert response.status_code == 200
But I keep getting a 401 response corresponding to an Unauthorized access. Is there any problem with my method?
Thanks.