On Tue, Jan 6, 2009 at 4:22 AM, Diez B. Roggisch <[email protected]> wrote: > > Jorge Vargas schrieb: >> On Mon, Jan 5, 2009 at 9:25 AM, aubry-yves <[email protected]> wrote: >>> >>> Hello, >>> I write unit tests for an application TG2. >>> I followed these docs: >>> http://docs.turbogears.org/2.0/RoughDocs/AppTesting >>> http://wiki.pylonshq.com/display/pylonsdocs/Unit+Testing >>> >>> But I do not know how to test the pages with authenticated based on >>> repoze.who >>> >>> There is an example here, to assign a value to REMOTE_USER: >>> http://pythonpaste.org/webtest/#modifying-the-environment-simulating-authentication >>> >>> But it makes no difference. >> >> Hi, I have been wanting to document this for some time, we had the >> same trouble on an application I'm working on. >> The short answer is that you need to call login on each request, one >> way of solving this is by using the following base webtest class. > > I guess you mean "on each test" here, not request. For that reason, I > would recommend putting the login-code into the setUp-call, but that's a > matter of taste of course. > > We maybe should grow some AuthenticatedTest-case-thingy to subclass from. >
yes indeed, sorry about the wording. As for using setUp, that seems be a good idea, as this should be considered part of the fixture. To be honest I put it in init just to be sure it worked and it just stayed there for that project. I got a scheduled move for that project into tg2.0b2 this week. I'll take a better look at this and probably provide a patch for quickstart. Since we already have a default set of users we could use those... adding a little login method and explaining a bit of what setUp is supposed to do. > Diez > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

