'Users can be created and can set their password'

def test_user(self):

    u = User.objects.create_user('testuser', 'test@example.com', 'testpw')
    self.assertTrue(u.has_usable_password())
    self.assertFalse(u.check_password('bad'))
    self.assertTrue(u.check_password('testpw'))
    u.set_unusable_password()
    u.save()
    self.assertFalse(u.check_password('testpw'))
    self.assertFalse(u.has_usable_password())
    u.set_password('testpw')
    self.assertTrue(u.check_password('testpw'))
    u.set_password(None)
    self.assertFalse(u.has_usable_password())
    self.assertEqual(u.get_username(), 'testuser')
    self.assertFalse(u.is_anonymous)
    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('testuser2', 'test2@example.com')
    self.assertFalse(u2.has_usable_password())
