def test_Token_unimpersonate(): hToken = win32security.LogonUser("alice", "", "Passw0rd", win32security.LOGON32_LOGON_NETWORK, win32security.LOGON32_PROVIDER_DEFAULT) win32security.ImpersonateLoggedOnUser(_tokens.Token(hToken).pyobject()) assert _tokens.token().Owner.pyobject() == alice win32security.RevertToSelf() assert _tokens.token().Owner.pyobject() == me
def test_Token_unimpersonate (): hToken = win32security.LogonUser ( "alice", "", "Passw0rd", win32security.LOGON32_LOGON_NETWORK, win32security.LOGON32_PROVIDER_DEFAULT ) win32security.ImpersonateLoggedOnUser (_tokens.Token (hToken).pyobject ()) assert _tokens.token ().Owner.pyobject () == alice win32security.RevertToSelf () assert _tokens.token ().Owner.pyobject () == me
def test_Token_unimpersonate(self): hToken = win32security.LogonUser( "alice", "", "Passw0rd", win32security.LOGON32_LOGON_NETWORK, win32security.LOGON32_PROVIDER_DEFAULT ) me = _tokens.token().Owner.pyobject() win32security.ImpersonateLoggedOnUser(_tokens.Token(hToken).pyobject()) self.assertEquals(_tokens.token().Owner.pyobject(), self.alice) win32security.RevertToSelf() self.assertEquals(_tokens.token().Owner.pyobject(), me)
def test_Token_dump(self): # # This is a bit crude, but we're hoping to exercise all of the # token attributes this way. # dumped = _tokens.token().dumped(0)
def test_token_default(self): assert _tokens.token().Statistics['AuthenticationId'] == win32security.GetTokenInformation(self.token0, win32security.TokenStatistics)['AuthenticationId'] assert _tokens.token().Origin == win32security.GetTokenInformation(self.token0, win32security.TokenOrigin)
def test_token_None(self): assert _tokens.token(None) is None