Skip to content

Commit

Permalink
fix: add test to handle pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
gcharest authored Feb 2, 2024
1 parent 2a0a993 commit 68a262c
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ def test_list_folders_returns_folder_names(get_google_service_mock):
]


@patch("integrations.google_workspace.google_drive.get_google_service")
def test_list_folders_iterates_over_pages(get_google_service_mock):
get_google_service_mock.return_value.files.return_value.list.return_value.execute.side_effect = [
{"files": [{"name": "test_folder"}], "nextPageToken": "token"},
{"files": [{"name": "test_folder2"}]},
]
assert google_drive.list_folders_in_folder("parent_folder") == [
{"name": "test_folder"},
{"name": "test_folder2"},
]


@patch("integrations.google_workspace.google_drive.list_metadata")
def test_healthcheck_healthy(list_metadata_mock):
list_metadata_mock.return_value = {"id": "test_doc"}
Expand Down

0 comments on commit 68a262c

Please sign in to comment.