Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def test_post_login_form_connected(self):
- # Conditions
- user = User.objects.create_user('toto_username', 'toto@example.com', 'toto_password')
- # Actions
- data = {
- 'email': 'toto@example.com',
- 'password': 'toto_password',
- }
- response = self.client.post('/login/', data)
- # Verify Redirect
- self.assertRedirects(response, '/home/', 302, 200)
- # Verify authentication
- # Check if the users id is stored in the session
- # If so that means that we're authenticated
- self.assertEqual(self.client.session['_auth_user_id'], user.pk)
Add Comment
Please, Sign In to add comment