Skip to content

Commit 1f7134b

Browse files
committed
Accomodate hash randomization moar.
1 parent 1d37881 commit 1f7134b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

oauth2/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,15 +269,15 @@ def to_string(self):
269269
The resulting string includes the token's secret, so you should never
270270
send or store this string where a third party can read it.
271271
"""
272-
273-
data = {
274-
'oauth_token': self.key,
275-
'oauth_token_secret': self.secret,
276-
}
272+
items = [
273+
('oauth_token', self.key),
274+
('oauth_token_secret', self.secret),
275+
]
277276

278277
if self.callback_confirmed is not None:
279-
data['oauth_callback_confirmed'] = self.callback_confirmed
280-
return urlencode(data)
278+
items.append(
279+
('oauth_callback_confirmed', self.callback_confirmed))
280+
return urlencode(items)
281281

282282
@staticmethod
283283
def from_string(s):

tests/test_oauth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ def test_get_callback_url(self):
215215
self.assertEqual(url, '%s%s' % (cb, verifier_str))
216216

217217
def test_to_string(self):
218-
string = 'oauth_token_secret=%s&oauth_token=%s' % (self.secret,
219-
self.key)
218+
string = 'oauth_token=%s&oauth_token_secret=%s' % (
219+
self.key, self.secret)
220220
self.assertEqual(self.token.to_string(), string)
221221

222222
self.token.set_callback('http://www.example.com/my-callback')
@@ -236,7 +236,7 @@ def _compare_tokens(self, new):
236236
def test___str__(self):
237237
tok = oauth.Token('tooken', 'seecret')
238238
self.assertEqual(str(tok),
239-
'oauth_token_secret=seecret&oauth_token=tooken')
239+
'oauth_token=tooken&oauth_token_secret=seecret')
240240

241241
def test_from_string(self):
242242
self.assertRaises(ValueError, lambda: oauth.Token.from_string(''))

0 commit comments

Comments
 (0)