Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rewrite this test case to prove the if condition

  • Loading branch information...
commit 73217d481689721d836f7b7b5d0f3d7a86b58dbe 1 parent 60870cc
@tswicegood tswicegood authored simplegeo committed
Showing with 27 additions and 2 deletions.
  1. +27 −2 tests/test_oauth.py
View
29 tests/test_oauth.py
@@ -26,6 +26,7 @@
import unittest
import oauth2 as oauth
+import random
import time
import urllib
import urlparse
@@ -369,10 +370,34 @@ def test_get_normalized_parameters(self):
req = oauth.Request("GET", url, params)
- res = dict(parse_qsl(req.get_normalized_parameters()))
+ res = req.get_normalized_parameters()
+
+ self.assertEquals(urllib.urlencode(sorted(params.items())), res)
+
+ def test_get_normalized_parameters_ignores_auth_signature(self):
+ url = "http://sp.example.com/"
+
+ params = {
+ 'oauth_version': "1.0",
+ 'oauth_nonce': "4572616e48616d6d65724c61686176",
+ 'oauth_timestamp': "137131200",
+ 'oauth_consumer_key': "0685bd9184jfhq22",
+ 'oauth_signature_method': "HMAC-SHA1",
+ 'oauth_signature': "some-random-signature-%d" % random.randint(1000, 2000),
+ 'oauth_token': "ad180jjd733klru7",
+ }
+
+ req = oauth.Request("GET", url, params)
+
+ res = req.get_normalized_parameters()
+
+ self.assertNotEquals(urllib.urlencode(sorted(params.items())), res)
foo = params.copy()
- self.assertEquals(foo, res)
+ del foo["oauth_signature"]
+ self.assertEqual(urllib.urlencode(sorted(foo.items())), res)
+
+
def test_sign_request(self):
url = "http://sp.example.com/"
Please sign in to comment.
Something went wrong with that request. Please try again.