#NEWLINE# def test_Token_impersonate( self ) : #NEWLINE# #INDENT# ( self . alice , system , type ) = win32security . LookupAccountName ( None , 'alice' ) #NEWLINE# hToken = win32security . LogonUser ( 'alice' , '' , 'Passw0rd' , win32security . LOGON32_LOGON_NETWORK , win32security . LOGON32_PROVIDER_DEFAULT ) #NEWLINE# token = _tokens . Token ( hToken ) #NEWLINE# try : #NEWLINE# #INDENT# token . impersonate ( ) #NEWLINE# assert ( token . Owner . pyobject ( ) == system . alice ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# win32security . RevertToSelf ( )