File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ def add_activity(self, activity_data):
4646 activity_data = {'actor': 1, 'verb': 'tweet', 'object': 1}
4747 activity_id = feed.add_activity(activity_data)
4848 '''
49+ if activity_data .get ('to' ) and type (activity_data .get ('to' )) is str :
50+ raise TypeError ('please provide the activity\' s to field as a list not a string' )
51+
4952 if activity_data .get ('to' ):
5053 activity_data ['to' ] = self .add_to_signature (activity_data ['to' ])
5154
Original file line number Diff line number Diff line change @@ -155,6 +155,17 @@ def test_add_activity_to(self):
155155 # and the flat feed
156156 activities = team_follower_feed .get (limit = 1 )['results' ]
157157 self .assertFirstActivityIDNotEqual (activities , activity_id )
158+
159+
160+ def test_add_activity_to_type_error (self ):
161+ user_feed = getfeed ('user' , '1' )
162+ activity_data = {
163+ 'actor' : 1 , 'verb' : 'tweet' , 'object' : 1 ,
164+ 'to' : 'string'
165+ }
166+
167+ with self .assertRaises (TypeError ):
168+ user_feed .add_activity (activity_data )
158169
159170 def assertFirstActivityIDEqual (self , activities , correct_activity_id ):
160171 activity_id = None
You can’t perform that action at this time.
0 commit comments