本文整理匯總了Python中plone.protect.authenticator.AuthenticatorView.authenticator方法的典型用法代碼示例。如果您正苦於以下問題:Python AuthenticatorView.authenticator方法的具體用法?Python AuthenticatorView.authenticator怎麽用?Python AuthenticatorView.authenticator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類plone.protect.authenticator.AuthenticatorView
的用法示例。
在下文中一共展示了AuthenticatorView.authenticator方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: AuthenticatorTests
# 需要導入模塊: from plone.protect.authenticator import AuthenticatorView [as 別名]
# 或者: from plone.protect.authenticator.AuthenticatorView import authenticator [as 別名]
class AuthenticatorTests(KeyringTestCase):
def setUp(self):
KeyringTestCase.setUp(self)
self.view = AuthenticatorView(None, None)
def setUsername(self, name):
user = getSecurityManager().getUser()
user.name = name
def setSecret(self, secret):
self.manager['_forms'].data[0] = secret
def testIsHtmlInput(self):
auth = self.view.authenticator()
self.failUnless(auth.startswith("<input"))
self.failUnless(auth.endswith("/>"))
def testDiffersPerUser(self):
one = self.view.authenticator()
self.setUsername("other")
two = self.view.authenticator()
self.assertNotEqual(one, two)
def testDiffersPerSecret(self):
one = self.view.authenticator()
self.setSecret("other")
two = self.view.authenticator()
self.assertNotEqual(one, two)
def testDiffersPerExtra(self):
one = self.view.authenticator()
two = self.view.authenticator('some-extra-value')
self.assertNotEqual(one, two)