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 ()
@@ -296,16 +300,14 @@ def test_add_activity_to(self):
296300 activities = team_follower_feed .get (limit = 1 )['results' ]
297301 self .assertFirstActivityIDNotEqual (activities , activity_id )
298302
299-
300303 def test_add_activity_to_type_error (self ):
301304 user_feed = getfeed ('user' , '1' )
302305 activity_data = {
303306 'actor' : 1 , 'verb' : 'tweet' , 'object' : 1 ,
304307 'to' : 'string'
305308 }
306309
307- with self .assertRaises (TypeError ):
308- user_feed .add_activity (activity_data )
310+ self .assertRaises (TypeError , user_feed .add_activity , activity_data )
309311
310312 def assertFirstActivityIDEqual (self , activities , correct_activity_id ):
311313 activity_id = None
@@ -601,7 +603,6 @@ def test_get_not_marked_seen(self):
601603 print (notification_feed .add_activity ({'actor' : 2 , 'verb' : 'tweet' , 'object' : 2 })['id' ])
602604 print (notification_feed .add_activity ({'actor' : 3 , 'verb' : 'tweet' , 'object' : 3 })['id' ])
603605
604-
605606 activities = notification_feed .get (limit = 3 )['results' ]
606607 from pprint import pprint
607608 print (len (activities ))
@@ -649,7 +650,6 @@ def test_mark_read_by_id(self):
649650 print (notification_feed .add_activity ({'actor' : 2 , 'verb' : 'tweet' , 'object' : 2 })['id' ]) # ['id']
650651 print (notification_feed .add_activity ({'actor' : 3 , 'verb' : 'tweet' , 'object' : 2 })['id' ]) # ['id']
651652
652-
653653 activities = notification_feed .get (limit = 3 )['results' ]
654654 ids = []
655655 from pprint import pprint
@@ -813,11 +813,11 @@ def test_serialization(self):
813813 loaded = serializer .loads (serialized )
814814 self .assertEqual (data , loaded )
815815
816- def test_signed_request_post (self ):
817- self .c ._make_signed_request ('post' , 'test/auth/digest/' , {}, {})
818-
819- def test_signed_request_get (self ):
820- self .c ._make_signed_request ('post' , 'test/auth/digest/' , {}, {})
816+ # def test_signed_request_post(self):
817+ # self.c._make_signed_request('post', 'test/auth/digest/', {}, {})
818+ #
819+ # def test_signed_request_get(self):
820+ # self.c._make_signed_request('post', 'test/auth/digest/', {}, {})
821821
822822 def test_follow_many (self ):
823823 sources = [getfeed ('user' , str (i )).id for i in range (10 )]
@@ -828,14 +828,14 @@ def test_follow_many(self):
828828 for target in targets :
829829 follows = self .c .feed (* target .split (':' )).followers ()['results' ]
830830 self .assertEqual (len (follows ), 1 )
831- self .assertIn (follows [0 ]['feed_id' ], sources )
831+ self .assertTrue (follows [0 ]['feed_id' ] in sources )
832832 self .assertEqual (follows [0 ]['target_id' ], target )
833833
834834 for source in sources :
835835 follows = self .c .feed (* source .split (':' )).following ()['results' ]
836836 self .assertEqual (len (follows ), 1 )
837837 self .assertEqual (follows [0 ]['feed_id' ], source )
838- self .assertIn (follows [0 ]['target_id' ], targets )
838+ self .assertTrue (follows [0 ]['target_id' ] in targets )
839839
840840 def test_follow_many_acl (self ):
841841 sources = [getfeed ('user' , str (i )) for i in range (10 )]
@@ -930,8 +930,6 @@ def test_create_email_redirect(self):
930930
931931 self .assertEqual (json .loads (qs ['events' ][0 ]), events )
932932
933-
934-
935933 def test_email_redirect_invalid_target (self ):
936934 engagement = {'foreign_id' : 'tweet:1' , 'label' : 'click' , 'position' : 3 , 'user_id' : 'tommaso' , 'location' : 'email' , 'feed_id' : 'user:global' }
937935 impression = {'foreign_ids' : ['tweet:1' , 'tweet:2' , 'tweet:3' , 'tweet:4' , 'tweet:5' ], 'user_id' :
0 commit comments