#NEWLINE# def test_management_command( self ) : #NEWLINE# #INDENT# '\n        The ``cleanupregistration`` management command properly\n        deletes expired accounts.\n\n        ' #NEWLINE# RegistrationProfile . objects . create_inactive_user ( site = Site . objects . get_current ( ) , ** expired_user . user_info ) #NEWLINE# expired_user = RegistrationProfile . objects . create_inactive_user ( site = Site . objects . get_current ( ) , username = 'bob' , password = 'secret' , email = 'bob@example.com' ) #NEWLINE# expired_user . date_joined -= datetime . timedelta ( days = ( settings . ACCOUNT_ACTIVATION_DAYS + 1 ) ) #NEWLINE# expired_user . save ( ) #NEWLINE# management . call_command ( 'cleanupregistration' ) #NEWLINE# self . assertEqual ( RegistrationProfile . objects . count ( ) , 1 ) #NEWLINE# self . assertRaises ( UserModel ( ) . DoesNotExist , UserModel ( ) . objects . get , username = 'bob' )