test_validators.py 文件源码

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

项目:django-toolkit 作者: luizalabs 项目源码 文件源码
def test_validate_bearer_token_should_get_cache_expiration_from_token(
        self,
        access_token,
        validator,
        scopes,
        http_request
    ):
        expires = timezone.now() - timedelta(seconds=5)
        access_token.expires = expires
        access_token.save()

        self._warm_up_cache(
            validator,
            access_token.token,
            scopes,
            http_request
        )

        with CaptureQueriesContext(connection) as context:
            validator.validate_bearer_token(
                access_token.token,
                scopes,
                http_request
            )

        assert len(context.captured_queries) == 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号