本文整理匯總了Python中ldapcherry.LdapCherry.auth_mode方法的典型用法代碼示例。如果您正苦於以下問題:Python LdapCherry.auth_mode方法的具體用法?Python LdapCherry.auth_mode怎麽用?Python LdapCherry.auth_mode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ldapcherry.LdapCherry
的用法示例。
在下文中一共展示了LdapCherry.auth_mode方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testAuth
# 需要導入模塊: from ldapcherry import LdapCherry [as 別名]
# 或者: from ldapcherry.LdapCherry import auth_mode [as 別名]
def testAuth(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry_test.ini', app)
app.auth_mode = 'and'
ret1 = app._auth('jsmith', 'passwordsmith')
app.auth_mode = 'or'
ret2 = app._auth('jsmith', 'passwordsmith')
assert ret2 == {'connected': True, 'isadmin': False} and \
ret1 == {'connected': True, 'isadmin': False}
示例2: testLoginFailure
# 需要導入模塊: from ldapcherry import LdapCherry [as 別名]
# 或者: from ldapcherry.LdapCherry import auth_mode [as 別名]
def testLoginFailure(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry_test.ini', app)
app.auth_mode = 'or'
try:
app.login(u'jwatsoné', u'wrongPasswordé')
except cherrypy.HTTPRedirect as e:
expected = 'http://127.0.0.1:8080/signin'
assert e.urls[0] == expected
else:
raise AssertionError("expected an exception")
示例3: testLogin
# 需要導入模塊: from ldapcherry import LdapCherry [as 別名]
# 或者: from ldapcherry.LdapCherry import auth_mode [as 別名]
def testLogin(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry_test.ini', app)
app.auth_mode = 'or'
try:
app.login('jwatson', 'passwordwatson')
except cherrypy.HTTPRedirect as e:
expected = 'http://127.0.0.1:8080/'
assert e[0][0] == expected
else:
raise AssertionError("expected an exception")