11from __future__ import unicode_literals , print_function
22import unittest
3- import sys
43import requests
54from io import StringIO
65
2322except ImportError :
2423 jwt = None
2524
26- if sys .version [0 ] == "3" :
27- unicode_type = str
28- else :
29- unicode_type = unicode # noqa
30-
3125
3226TEST_RSA_KEY = (
3327 "-----BEGIN RSA PRIVATE KEY-----\n "
@@ -165,17 +159,17 @@ def test_parse_response_url(self):
165159 self .assertEqual (resp ["oauth_token" ], "foo" )
166160 self .assertEqual (resp ["oauth_verifier" ], "bar" )
167161 for k , v in resp .items ():
168- self .assertIsInstance (k , unicode_type )
169- self .assertIsInstance (v , unicode_type )
162+ self .assertIsInstance (k , str )
163+ self .assertIsInstance (v , str )
170164
171165 def test_fetch_request_token (self ):
172166 auth = OAuth1Session ("foo" )
173167 auth .send = self .fake_body ("oauth_token=foo" )
174168 resp = auth .fetch_request_token ("https://example.com/token" )
175169 self .assertEqual (resp ["oauth_token" ], "foo" )
176170 for k , v in resp .items ():
177- self .assertIsInstance (k , unicode_type )
178- self .assertIsInstance (v , unicode_type )
171+ self .assertIsInstance (k , str )
172+ self .assertIsInstance (v , str )
179173
180174 def test_fetch_request_token_with_optional_arguments (self ):
181175 auth = OAuth1Session ("foo" )
@@ -185,17 +179,17 @@ def test_fetch_request_token_with_optional_arguments(self):
185179 )
186180 self .assertEqual (resp ["oauth_token" ], "foo" )
187181 for k , v in resp .items ():
188- self .assertIsInstance (k , unicode_type )
189- self .assertIsInstance (v , unicode_type )
182+ self .assertIsInstance (k , str )
183+ self .assertIsInstance (v , str )
190184
191185 def test_fetch_access_token (self ):
192186 auth = OAuth1Session ("foo" , verifier = "bar" )
193187 auth .send = self .fake_body ("oauth_token=foo" )
194188 resp = auth .fetch_access_token ("https://example.com/token" )
195189 self .assertEqual (resp ["oauth_token" ], "foo" )
196190 for k , v in resp .items ():
197- self .assertIsInstance (k , unicode_type )
198- self .assertIsInstance (v , unicode_type )
191+ self .assertIsInstance (k , str )
192+ self .assertIsInstance (v , str )
199193
200194 def test_fetch_access_token_with_optional_arguments (self ):
201195 auth = OAuth1Session ("foo" , verifier = "bar" )
@@ -205,8 +199,8 @@ def test_fetch_access_token_with_optional_arguments(self):
205199 )
206200 self .assertEqual (resp ["oauth_token" ], "foo" )
207201 for k , v in resp .items ():
208- self .assertIsInstance (k , unicode_type )
209- self .assertIsInstance (v , unicode_type )
202+ self .assertIsInstance (k , str )
203+ self .assertIsInstance (v , str )
210204
211205 def _test_fetch_access_token_raises_error (self , auth ):
212206 """Assert that an error is being raised whenever there's no verifier
0 commit comments