File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99long_description = open ('README.rst' ).read ()
1010
11+ unit = 'unittest2py3k' if sys .version_info > (3 , 0 , 0 ) else 'unittest2'
1112tests_require = [
1213 'mock' ,
1314 'pep8' ,
14- 'unittest2' ,
15+ unit ,
1516 'pytest' ,
1617]
1718
19+
1820install_requires = [
1921 'requests>=2.3.0' ,
2022]
2123
2224
25+
26+
2327class PyTest (TestCommand ):
2428
2529 def finalize_options (self ):
Original file line number Diff line number Diff line change 33import base64
44
55
6+ def force_str (value ):
7+ if hasattr (value , 'encode' ):
8+ return value .encode ('utf8' )
9+ else :
10+ return value
11+
12+
613def b64_encode (s ):
714 return base64 .urlsafe_b64encode (s ).strip (b'=' )
815
@@ -19,6 +26,6 @@ def sign(secret, value):
1926
2027 '''
2128 key = hashlib .sha1 ((secret ).encode ('utf-8' )).digest ()
22- signed = hmac .new (key , msg = str (value ), digestmod = hashlib .sha1 )
29+ signed = hmac .new (key , msg = force_str (value ), digestmod = hashlib .sha1 )
2330 signature = b64_encode (signed .digest ())
24- return str (signature )
31+ return force_str (signature )
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ class ClientTest(TestCase):
1010 def setUp (self ):
1111 # DEBUG account details
1212 self .c = stream .connect (
13- '5crf3bhfzesn' ,
14- 'tfq2sdqpj9g446sbv653x3aqmgn33hsn8uzdc9jpskaw8mj6vsnhzswuwptuj9su'
13+ u '5crf3bhfzesn' ,
14+ u 'tfq2sdqpj9g446sbv653x3aqmgn33hsn8uzdc9jpskaw8mj6vsnhzswuwptuj9su'
1515 )
1616 self .user1 = self .c .feed ('user:1' )
1717 self .aggregated2 = self .c .feed ('aggregated:2' )
@@ -54,13 +54,13 @@ def test_flat_follow(self):
5454 def _get_first_aggregated_activity (self , activities ):
5555 try :
5656 return activities [0 ]['activities' ][0 ]
57- except IndexError , e :
57+ except IndexError as e :
5858 pass
5959
6060 def _get_first_activity (self , activities ):
6161 try :
6262 return activities [0 ]
63- except IndexError , e :
63+ except IndexError as e :
6464 pass
6565
6666 def test_unfollow (self ):
You can’t perform that action at this time.
0 commit comments