1👍
I don’t understand your logic, because you are using get_object_or_404
function to try to get the actually user from request.user, but your view uses AllowAny, so in some cases this field could be None, and your response could 404.
Maybe you need get to auth some user in your Jupyter "Testing Code"?
But I think is a bad idea testing code with Jupyter, because that is not a testing case or something else.
You can to try use Pytest https://docs.pytest.org/en/7.2.x/, coverage https://coverage.readthedocs.io/en/6.5.0/ to test your code, is very easy and beatuful!
Source:stackexchange.com