File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -230,9 +230,10 @@ def _next_cursor_is_present(data) -> bool:
230230 A boolean value.
231231 """
232232 # Only admin.conversations.search returns next_cursor at the top level
233- present = ("next_cursor" in data and data ["next_cursor" ] != "" ) or (
233+ present = ("next_cursor" in data and data ["next_cursor" ] is not None and data [ "next_cursor" ] != "" ) or (
234234 "response_metadata" in data
235235 and "next_cursor" in data ["response_metadata" ]
236+ and data ["response_metadata" ]["next_cursor" ] is not None
236237 and data ["response_metadata" ]["next_cursor" ] != ""
237238 )
238239 return present
Original file line number Diff line number Diff line change 1111 _build_unexpected_body_error_message ,
1212 _parse_web_class_objects ,
1313 _to_v2_file_upload_item ,
14+ _next_cursor_is_present ,
1415)
1516
1617
@@ -98,3 +99,12 @@ def test_files_upload_v2_issue_1356(self):
9899 assert file_io_item .get ("filename" ) == "Uploaded file"
99100 file_io_item = _to_v2_file_upload_item ({"file" : file_io , "filename" : "foo.txt" })
100101 assert file_io_item .get ("filename" ) == "foo.txt"
102+
103+ def test_next_cursor_is_present (self ):
104+ assert _next_cursor_is_present ({"next_cursor" : "next-page" }) is True
105+ assert _next_cursor_is_present ({"next_cursor" : "" }) is False
106+ assert _next_cursor_is_present ({"next_cursor" : None }) is False
107+ assert _next_cursor_is_present ({"response_metadata" : {"next_cursor" : "next-page" }}) is True
108+ assert _next_cursor_is_present ({"response_metadata" : {"next_cursor" : "" }}) is False
109+ assert _next_cursor_is_present ({"response_metadata" : {"next_cursor" : None }}) is False
110+ assert _next_cursor_is_present ({"something_else" : {"next_cursor" : "next-page" }}) is False
You can’t perform that action at this time.
0 commit comments