Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bff5348

Browse files
tswicegoodsimplegeo
authored andcommitted
Add a test to prove the code...
1 parent 73217d4 commit bff5348

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/test_oauth.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,18 @@ def test_get_normalized_parameters_ignores_auth_signature(self):
397397
del foo["oauth_signature"]
398398
self.assertEqual(urllib.urlencode(sorted(foo.items())), res)
399399

400-
401-
400+
def test_get_normalized_string_escapes_spaces_properly(self):
401+
url = "http://sp.example.com/"
402+
params = {
403+
"some_random_data": random.randint(100, 1000),
404+
"data": "This data with a random number (%d) has spaces!" % random.randint(1000, 2000),
405+
}
406+
407+
req = oauth.Request("GET", url, params)
408+
res = req.get_normalized_parameters()
409+
expected = urllib.urlencode(sorted(params.items())).replace('+', '%20')
410+
self.assertEqual(expected, res)
411+
402412
def test_sign_request(self):
403413
url = "http://sp.example.com/"
404414

0 commit comments

Comments
 (0)