#NEWLINE# def test_createsuperuser_management_command( self ) : #NEWLINE# #INDENT# 'Check the operation of the createsuperuser management command' #NEWLINE# new_io = StringIO ( ) #NEWLINE# call_command ( 'createsuperuser' , interactive = False , username = 'joe' , email = 'joe@somewhere.org' , stdout = new_io ) #NEWLINE# command_output = new_io . getvalue ( ) . strip ( ) #NEWLINE# self . assertEqual ( command_output , 'Superuser created successfully.' ) #NEWLINE# u = User . objects . get ( username = 'joe' ) #NEWLINE# self . assertEquals ( u . email , 'joe@somewhere.org' ) #NEWLINE# self . assertTrue ( u . check_password ( '' ) ) #NEWLINE# new_io = StringIO ( ) #NEWLINE# call_command ( 'createsuperuser' , interactive = False , username = 'joe2' , email = 'joe2@somewhere.org' , verbosity = 0 , stdout = new_io ) #NEWLINE# command_output = new_io . getvalue ( ) . strip ( ) #NEWLINE# self . assertEqual ( command_output , '' ) #NEWLINE# u = User . objects . get ( username = 'joe2' ) #NEWLINE# self . assertEquals ( command_output . email , 'joe2@somewhere.org' ) #NEWLINE# self . assertTrue ( u . check_password ( '' ) ) #NEWLINE# new_io = StringIO ( ) #NEWLINE# call_command ( 'createsuperuser' , interactive = False , username = 'joe+admin@somewhere.org' , email = 'joe@somewhere.org' , stdout = new_io ) #NEWLINE# u = User . objects . get ( username = 'joe+admin@somewhere.org' ) #NEWLINE# self . assertEquals ( u . email , 'joe@somewhere.org' ) #NEWLINE# self . assertTrue ( u . check_password ( '' ) )