Created
October 6, 2011 09:01
-
-
Save hynek/1266898 to your computer and use it in GitHub Desktop.
A decorator for Django tests that logs you in before running a test.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def login_first(test): | |
"""Decorator offering convenience login for tests that require it.""" | |
def _login(self): | |
self.client.login( | |
username='testusername', | |
password='testpassword') | |
return test(self) | |
return _login |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment