On Tue, May 20, 2008 at 9:19 PM, Julien <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a site where pretty much all views (except for register, login > and logout) require the user to log in. Now that the number of views > has grown I'd like to test that I didn't forget to protect them with > the login_required decorator. > > I'm looking for an automated way to do that. Is that achievable, and > if so, how? > > I've started looking into unit testing but I'm struggling a bit and > I'm not sure if that could do the trick. What I'd like to do is test > all possible urls from the URLConf and spot those that are not > redirected to the login page. > > Any hint?
Julien, I'd just use 'grep' for this: grep -A 2 -R --include="*.py" -E "^def .*\(req" ./ That'll show two lines above a view definition - so just look for any that are missing @login_required. Course, that's hardly portable... Adam > > Thank you, > > Julien > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

