@@ -545,6 +545,38 @@ def test_get_normalized_parameters_empty(self):
545545
546546 self .assertEquals (expected , res )
547547
548+ def test_get_normalized_parameters_from_url (self ):
549+ # example copied from
550+ # https://github.com/ciaranj/node-oauth/blob/master/tests/oauth.js
551+ # which in turns says that it was copied from
552+ # http://oauth.net/core/1.0/#sig_base_example .
553+ 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"
554+
555+ req = oauth .Request ("GET" , url )
556+
557+ res = req .get_normalized_parameters ()
558+
559+ 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'
560+
561+ self .assertEquals (expected , res )
562+
563+ def test_signing_base (self ):
564+ # example copied from
565+ # https://github.com/ciaranj/node-oauth/blob/master/tests/oauth.js
566+ # which in turns says that it was copied from
567+ # http://oauth.net/core/1.0/#sig_base_example .
568+ 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"
569+
570+ req = oauth .Request ("GET" , url )
571+
572+ sm = oauth .SignatureMethod_HMAC_SHA1 ()
573+
574+ consumer = oauth .Consumer ('dpf43f3p2l4k3l03' , 'foo' )
575+ key , raw = sm .signing_base (req , consumer , None )
576+
577+ expected = 'GET&http%3A%2F%2Fphotos.example.net%2Fphotos&file%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal'
578+ self .assertEquals (expected , raw )
579+
548580 def test_get_normalized_parameters (self ):
549581 url = "http://sp.example.com/"
550582
0 commit comments