66import random
77
88
9+ def connect_debug ():
10+ return stream .connect (
11+ u'5crf3bhfzesn' ,
12+ u'tfq2sdqpj9g446sbv653x3aqmgn33hsn8uzdc9jpskaw8mj6vsnhzswuwptuj9su'
13+ )
14+
15+ client = connect_debug ()
16+ user1 = client .feed ('user:1' )
17+ aggregated2 = client .feed ('aggregated:2' )
18+ aggregated3 = client .feed ('aggregated:3' )
19+ flat3 = client .feed ('flat:3' )
20+
921class ClientTest (TestCase ):
1022
1123 def setUp (self ):
1224 # DEBUG account details
13- self .c = stream .connect (
14- u'5crf3bhfzesn' ,
15- u'tfq2sdqpj9g446sbv653x3aqmgn33hsn8uzdc9jpskaw8mj6vsnhzswuwptuj9su'
16- )
17- self .user1 = self .c .feed ('user:1' )
18- self .aggregated2 = self .c .feed ('aggregated:2' )
19- self .flat3 = self .c .feed ('flat:3' )
25+ self .c = client
26+ self .user1 = user1
27+ self .aggregated2 = aggregated2
28+ self .aggregated3 = aggregated3
29+ self .flat3 = flat3
2030
2131 def test_add_activity (self ):
2232 activity_data = {'actor' : 1 , 'verb' : 'tweet' , 'object' : 1 }
@@ -37,7 +47,7 @@ def test_follow(self):
3747 activity_data = {'actor' : actor_id , 'verb' : 'tweet' , 'object' : 1 }
3848 activity_id = self .user1 .add_activity (activity_data )['id' ]
3949 self .aggregated2 .follow ('user:1' )
40- time .sleep (10 )
50+ time .sleep (5 )
4151 activities = self .aggregated2 .get (limit = 3 )['results' ]
4252 activity = self ._get_first_aggregated_activity (activities )
4353 activity_id_found = activity ['id' ] if activity is not None else None
@@ -68,10 +78,10 @@ def _get_first_activity(self, activities):
6878 def test_unfollow (self ):
6979 activity_data = {'actor' : 1 , 'verb' : 'tweet' , 'object' : 1 }
7080 activity_id = self .user1 .add_activity (activity_data )['id' ]
71- self .aggregated2 .follow ('user:1' )
72- self .aggregated2 .unfollow ('user:1' )
81+ self .aggregated3 .follow ('user:1' )
82+ self .aggregated3 .unfollow ('user:1' )
7383 time .sleep (5 )
74- activities = self .aggregated2 .get (limit = 3 )['results' ]
84+ activities = self .aggregated3 .get (limit = 3 )['results' ]
7585 activity = self ._get_first_aggregated_activity (activities )
7686 activity_id_found = activity ['id' ] if activity is not None else None
7787 self .assertNotEqual (activity_id_found , activity_id )
0 commit comments