I want to test
- if a views decorator works properly
- if a proper view is called
So, here's decorator get_object
and view features
are in myapp.views
.
@get_object
def features(request, object):
return {}
I try mocking this:
new_view = Mock(__name__='features', return_value={})
decorated = get_object(new_view)
with patch('myapp.views.features') as features:
features = decorated
client = Client()
response = client.get('/features')
print new_view.call_args
This shows nothing, as if the mock object was not called, although I suppose it should have been.
How can I mock the decorated view properly?