File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -2048,7 +2048,6 @@ def block_user_dm(self, target_user_id: str):
20482048 data = self ._parse_response (resp )
20492049 return data
20502050
2051-
20522051 def unblock_user_dm (self , target_user_id : str ):
20532052 """
20542053 Allows the authenticated user to unblock direct messages (DMs) from the target user.
@@ -2062,7 +2061,6 @@ def unblock_user_dm(self, target_user_id: str):
20622061 data = self ._parse_response (resp )
20632062 return data
20642063
2065-
20662064 def get_user_muting (
20672065 self ,
20682066 user_id : str ,
Original file line number Diff line number Diff line change @@ -153,6 +153,27 @@ def test_block_and_unblock_user(api_with_user):
153153 assert not resp ["data" ]["blocking" ]
154154
155155
156+ @responses .activate
157+ def test_block_and_unblock_user_dm (api_with_user ):
158+ target_user_id = "123456"
159+
160+ responses .add (
161+ method = responses .POST ,
162+ url = f"https://api.twitter.com/2/users/{ target_user_id } /dm/block" ,
163+ json = {"data" : {"blocked" : True }},
164+ )
165+ resp = api_with_user .block_user_dm (target_user_id = target_user_id )
166+ assert resp ["data" ]["blocked" ]
167+
168+ responses .add (
169+ method = responses .POST ,
170+ url = f"https://api.twitter.com/2/users/{ target_user_id } /dm/unblock" ,
171+ json = {"data" : {"blocked" : False }},
172+ )
173+ resp = api_with_user .unblock_user_dm (target_user_id = target_user_id )
174+ assert not resp ["data" ]["blocked" ]
175+
176+
156177@responses .activate
157178def test_get_blocking_users (api_with_user , helpers ):
158179 users_data = helpers .load_json_data (
You can’t perform that action at this time.
0 commit comments