test_oauth_dance.py 文件源码

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

项目:peony-twitter 作者: odrling 项目源码 文件源码
def test_get_oauth_verifier_browser_error():
    def error(url):
        raise RuntimeError

    stream = io.StringIO()
    url = "https://api.twitter.com/oauth/authorize?oauth_token=abc"

    with patch.object(oauth_dance.asyncio, 'sleep', side_effect=dummy):
        with patch.object(oauth_dance.webbrowser, 'open', side_effect=error):
            with patch.object(oauth_dance, 'input', return_value="12345"):
                with redirect_stdout(stream):
                    await oauth_dance.get_oauth_verifier("abc")

                stream.seek(0)
                assert url in stream.read()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号