'Check the operation of the createsuperuser management command'

def test_createsuperuser(self):

    new_io = StringIO()
    call_command(u'createsuperuser', interactive=False, username=u'joe', email=u'joe@somewhere.org', stdout=new_io)
    command_output = new_io.getvalue().strip()
    self.assertEqual(command_output, u'Superuser    created    successfully.')
    u = User.objects.get(username=u'joe')
    self.assertEqual(u.email, u'joe@somewhere.org')
    self.assertFalse(u.has_usable_password())
