1👍
✅
You’re patching the wrong thing: all you’ve done is change what authenticate
refers to within your test, not in the view. You should patch your_view.auth.authenticate
.
See the Mock docs on Where to patch.
Source:stackexchange.com