← Back to team overview

launchpad-dev team mailing list archive

Re: Login helper love!

 

On Tuesday 20 July 2010 10:36:51 Jonathan Lange wrote:
> Are you tired of thinking?
> 
> Do you just want to write tests?
> 
> There are now branch new login helpers to help you not think and write
> tests at the same time.
> 
> with celebrity_logged_in('admin'):
>     ubuntu.name = 'jonobuntu'
> 
> or
> 
> @with_celebrity_logged_in('vcs_imports')
> def change_the_time():
>     pass
> 
> There's also anonymous_logged_in, person_logged_in,
> with_anonymous_logged_in and with_person_logged_in. Also, the less new
> login_as() and login_celebrity(). Read more about it at
> http://people.canonical.com/~mwh/canonicalapi/lp.testing.html.
> 
> All of this means there's absolutely no excuse for logging in with
> sampledata accounts ever.


This is very cool, thanks Jono.

What happens when the 'with' block finishes, does it log out or do nothing 
special? 



Follow ups

References