Skip to content

Instantly share code, notes, and snippets.

@jsanchezpando
Created January 5, 2012 11:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsanchezpando/1564761 to your computer and use it in GitHub Desktop.
Save jsanchezpando/1564761 to your computer and use it in GitHub Desktop.
base for test logged django site pages
from django.contrib.auth.models import User
class LoggedTestCase(TestCase):
def setUp(self):
self.user = User.objects.create_user('admin', 'test@example.com', 'pwd')
self.user.save()
self.client = Client()
self.client.login(username='admin', password='pwd')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment