lundi 4 avril 2016

django testing views with login_required decorator respecting DRY

I have a website where all views will be protected with @login_required, except for the login view, of course.
However, using the decorator will cause my tests calling these views to fail if I do not add an authentificated user to the request. I know that this can be done in setUp() but writing the same line in any test class is not respecting DRY principle.

Is there a better approach than this?

Aucun commentaire:

Enregistrer un commentaire