1👍
✅
@patch('core.views')
The above patch just mocks the file, which won’t have any effect. What you can use is:
@patch('core.views.CoreViewSet.list')
This will mock the list
method of the viewset, which you can then give a response object as the return_value
.
Source:stackexchange.com