Skip to content

Instantly share code, notes, and snippets.

@emperorcezar
Created March 31, 2011 19:43
Show Gist options
  • Save emperorcezar/897089 to your computer and use it in GitHub Desktop.
Save emperorcezar/897089 to your computer and use it in GitHub Desktop.
Authenticated Test
class AuthenticatedTest(unittest.TestCase):
def setUp(self):
self.c = Client()
# create login
user = User(username = 'test', password = 'test123', first_name = 'Test', last_name = 'McTesterson', email = 'test@test.com')
user.save()
# login
response = self.c.post('/accounts/login/', {'username': 'test', 'password': 'test123'})
print(response)
self.failUnlessEqual(response.status_code, 200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment