test_auth.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:django-iitg-auth 作者: narenchoudhary 项目源码 文件源码
def test_authenticate_value_type_exception(self, mock_pop3_ssl):
        """
        Test ``authenticate`` for ``ValueError`` or ``TypeError``
        exception.

        :param mock_pop3_ssl: mock path for `poplib.POP3_SSL``
        :return: None
        """
        request = HttpRequest()
        response = mock_pop3_ssl.return_value
        response.username.return_value = 123456
        response.pass_.return_value = 12345

        credentials = {
            'username': 'username',
            'password': 'password',
            'login_server': '202.141.80.10',
            'port': '995'
        }
        auth_backend = WebMailAuthenticationBackend()
        self.assertRaises(TypeError, auth_backend.authenticate, request, **credentials)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号