test_client.py 文件源码

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

项目:REMAP 作者: REMAPApp 项目源码 文件源码
def test_recursive_authorize(self):
        # Tests that OAuth2Credentials doesn't introduce new method
        # constraints. Formerly, OAuth2Credentials.authorize monkeypatched the
        # request method of the passed in HTTP object with a wrapper annotated
        # with @_helpers.positional(1). Since the original method has no such
        # annotation, that meant that the wrapper was violating the contract of
        # the original method by adding a new requirement to it. And in fact
        # the wrapper itself doesn't even respect that requirement. So before
        # the removal of the annotation, this test would fail.
        token_response = {'access_token': '1/3w', 'expires_in': 3600}
        encoded_response = json.dumps(token_response).encode('utf-8')
        http = http_mock.HttpMock(data=encoded_response)
        http = self.credentials.authorize(http)
        http = self.credentials.authorize(http)
        transport.request(http, 'http://example.com')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号