lundi 2 décembre 2019

Mock decorator in django test

I want to test below code in view.py:

class A(view):
   @has_access
   def get(request):
       .....

but I couldn't mock @has_access with patch('pathtouse.has_access').start() and even I tried with patch('pathtouse.has_access') as has_access

how can I mock @has_access? I don't want execute decorator when I test A.get()

Aucun commentaire:

Enregistrer un commentaire