44from stream .exceptions import ApiKeyException , InputException
55import random
66import jwt
7- from unittest .case import TestCase
7+ try :
8+ from unittest .case import TestCase
9+ except ImportError :
10+ from unittest import TestCase
811import json
912
1013import os
@@ -42,6 +45,7 @@ def connect_debug():
4245 location = 'us-east' ,
4346 timeout = 30 ,
4447 base_url = 'http://qa-api.getstream.io/api/' ,
48+ # base_url='http://localhost-api.getstream.io:8000/api/',
4549 )
4650
4751client = connect_debug ()
@@ -308,16 +312,14 @@ def test_add_activity_to(self):
308312 activities = team_follower_feed .get (limit = 1 )['results' ]
309313 self .assertFirstActivityIDNotEqual (activities , activity_id )
310314
311-
312315 def test_add_activity_to_type_error (self ):
313316 user_feed = getfeed ('user' , '1' )
314317 activity_data = {
315318 'actor' : 1 , 'verb' : 'tweet' , 'object' : 1 ,
316319 'to' : 'string'
317320 }
318321
319- with self .assertRaises (TypeError ):
320- user_feed .add_activity (activity_data )
322+ self .assertRaises (TypeError , user_feed .add_activity , activity_data )
321323
322324 def assertFirstActivityIDEqual (self , activities , correct_activity_id ):
323325 activity_id = None
@@ -610,7 +612,6 @@ def test_get_not_marked_seen(self):
610612 print (notification_feed .add_activity ({'actor' : 2 , 'verb' : 'tweet' , 'object' : 2 })['id' ])
611613 print (notification_feed .add_activity ({'actor' : 3 , 'verb' : 'tweet' , 'object' : 3 })['id' ])
612614
613-
614615 activities = notification_feed .get (limit = 3 )['results' ]
615616 from pprint import pprint
616617 print (len (activities ))
@@ -658,7 +659,6 @@ def test_mark_read_by_id(self):
658659 print (notification_feed .add_activity ({'actor' : 2 , 'verb' : 'tweet' , 'object' : 2 })['id' ]) # ['id']
659660 print (notification_feed .add_activity ({'actor' : 3 , 'verb' : 'tweet' , 'object' : 2 })['id' ]) # ['id']
660661
661-
662662 activities = notification_feed .get (limit = 3 )['results' ]
663663 ids = []
664664 from pprint import pprint
@@ -822,6 +822,12 @@ def test_serialization(self):
822822 loaded = serializer .loads (serialized )
823823 self .assertEqual (data , loaded )
824824
825+ # def test_signed_request_post(self):
826+ # self.c._make_signed_request('post', 'test/auth/digest/', {}, {})
827+ #
828+ # def test_signed_request_get(self):
829+ # self.c._make_signed_request('post', 'test/auth/digest/', {}, {})
830+
825831 def test_follow_many (self ):
826832 sources = [getfeed ('user' , str (i )).id for i in range (10 )]
827833 targets = [getfeed ('flat' , str (i )).id for i in range (10 )]
@@ -831,14 +837,14 @@ def test_follow_many(self):
831837 for target in targets :
832838 follows = self .c .feed (* target .split (':' )).followers ()['results' ]
833839 self .assertEqual (len (follows ), 1 )
834- self .assertIn (follows [0 ]['feed_id' ], sources )
840+ self .assertTrue (follows [0 ]['feed_id' ] in sources )
835841 self .assertEqual (follows [0 ]['target_id' ], target )
836842
837843 for source in sources :
838844 follows = self .c .feed (* source .split (':' )).following ()['results' ]
839845 self .assertEqual (len (follows ), 1 )
840846 self .assertEqual (follows [0 ]['feed_id' ], source )
841- self .assertIn (follows [0 ]['target_id' ], targets )
847+ self .assertTrue (follows [0 ]['target_id' ] in targets )
842848
843849 def test_follow_many_acl (self ):
844850 sources = [getfeed ('user' , str (i )) for i in range (10 )]
@@ -933,8 +939,6 @@ def test_create_email_redirect(self):
933939
934940 self .assertEqual (json .loads (qs ['events' ][0 ]), events )
935941
936-
937-
938942 def test_email_redirect_invalid_target (self ):
939943 engagement = {'foreign_id' : 'tweet:1' , 'label' : 'click' , 'position' : 3 , 'user_id' : 'tommaso' , 'location' : 'email' , 'feed_id' : 'user:global' }
940944 impression = {'foreign_ids' : ['tweet:1' , 'tweet:2' , 'tweet:3' , 'tweet:4' , 'tweet:5' ], 'user_id' :
0 commit comments