def test_authentication_manager_multi_complex_allow(self):
"""
Verify AuthenticationManager handles the complex allow case with multiple authenticators.
"""
expected_result = [bytes('itrustyou', 'utf8')]
def complex_auth(environ, start_response):
start_response('200 OK', [])
return expected_result
start_response = mock.MagicMock()
self.authentication_manager.authenticators = [
mock.MagicMock(authenticate=mock.MagicMock(return_value=False)),
mock.MagicMock(authenticate=complex_auth),
mock.MagicMock(authenticate=mock.MagicMock(return_value=False)),
]
result = self.authentication_manager(create_environ(), start_response)
self.assertEquals(expected_result, result)
start_response.assert_called_once_with('200 OK', mock.ANY)
test_authentication_manager.py 文件源码
python
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录