'Registration creates a new account and logs the user in.'

def test_registration(self):

    resp = self.client.post(reverse('registration_register'), data={'username': 'bob', 'email': 'bob@example.com', 'password1': 'secret', 'password2': 'secret'})
    new_user = UserModel().objects.get(username='bob')
    self.assertEqual(302, resp.status_code)
    self.failUnless((getattr(settings, 'SIMPLE_BACKEND_REDIRECT_URL', '/') in resp['Location']))
    self.failUnless(new_user.check_password('secret'))
    self.assertEqual(new_user.email, 'bob@example.com')
    self.failUnless(new_user.is_active)
    resp = self.client.get(reverse('registration_register'))
    self.failUnless(resp.context['user'].is_authenticated())
