1
- 如果意見裝飾工作正常
- 如果正確的觀點被稱爲
所以,這裏的裝飾get_object
,並查看features
是在myapp.views
。
@get_object
def features(request, object):
return {}
我嘗試嘲笑他:
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
這說明不了什麼,彷彿模擬對象不叫,但我想它應該是。
我怎樣才能正確地嘲笑裝飾看法?