'Check that users can be created and can set their password'

def test_user(self):

    u = User.objects.create_user(u'testuser', u'test@example.com', u'testpw')
    self.assertTrue(u.has_usable_password())
    self.assertFalse(u.check_password(u'bad'))
    self.assertTrue(u.check_password(u'testpw'))
    u.set_unusable_password()
    u.save()
    self.assertFalse(u.check_password(u'testpw'))
    self.assertFalse(u.has_usable_password())
    u.set_password(u'testpw')
    self.assertTrue(u.check_password(u'testpw'))
    u.set_password(None)
    self.assertFalse(u.has_usable_password())
    self.assertTrue(u.is_authenticated())
    self.assertFalse(u.is_staff)
    self.assertTrue(u.is_active)
    self.assertFalse(u.is_superuser)
    u2 = User.objects.create_user(u'testuser2', u'test2@example.com')
    self.assertFalse(u2.has_usable_password())
