test_oauth.py 文件源码

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

项目:OneClickDTU 作者: satwikkansal 项目源码 文件源码
def test_get_normalized_parameters_from_url(self):
        # example copied from
        # https://github.com/ciaranj/node-oauth/blob/master/tests/oauth.js
        # which in turns says that it was copied from
        # http://oauth.net/core/1.0/#sig_base_example .
        url = ("http://photos.example.net/photos?file=vacation.jpg"
               "&oauth_consumer_key=dpf43f3p2l4k3l03"
               "&oauth_nonce=kllo9940pd9333jh&oauth_signature_method=HMAC-SHA1"
               "&oauth_timestamp=1191242096&oauth_token=nnch734d00sl2jdk"
               "&oauth_version=1.0&size=original")

        req = oauth.Request("GET", url)

        res = req.get_normalized_parameters()

        expected = ('file=vacation.jpg&oauth_consumer_key=dpf43f3p2l4k3l03'
                    '&oauth_nonce=kllo9940pd9333jh'
                    '&oauth_signature_method=HMAC-SHA1'
                    '&oauth_timestamp=1191242096&oauth_token=nnch734d00sl2jdk'
                    '&oauth_version=1.0&size=original')

        self.assertEqual(expected, res)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号