diff --git a/backend/tests/daily/connectors/google_drive/consts_and_utils.py b/backend/tests/daily/connectors/google_drive/consts_and_utils.py index de669ac5ac4..e75b44630a8 100644 --- a/backend/tests/daily/connectors/google_drive/consts_and_utils.py +++ b/backend/tests/daily/connectors/google_drive/consts_and_utils.py @@ -128,12 +128,16 @@ _VALID_PREFIX = "file_" +def filter_invalid_prefixes(names: set[str]) -> set[str]: + return {name for name in names if name.startswith(_VALID_PREFIX)} + + def print_discrepencies( expected: set[str], retrieved: set[str], ) -> None: # Filter retrieved set to only include valid prefixed items - filtered_retrieved = {name for name in retrieved if name.startswith(_VALID_PREFIX)} + filtered_retrieved = filter_invalid_prefixes(retrieved) if expected != filtered_retrieved: print(expected) print(filtered_retrieved) diff --git a/backend/tests/daily/connectors/google_drive/test_slim_docs.py b/backend/tests/daily/connectors/google_drive/test_slim_docs.py index 312823e0ef6..ffe24d6ba02 100644 --- a/backend/tests/daily/connectors/google_drive/test_slim_docs.py +++ b/backend/tests/daily/connectors/google_drive/test_slim_docs.py @@ -15,6 +15,7 @@ from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_FILE_IDS from tests.daily.connectors.google_drive.consts_and_utils import ADMIN_FOLDER_3_FILE_IDS from tests.daily.connectors.google_drive.consts_and_utils import file_name_template +from tests.daily.connectors.google_drive.consts_and_utils import filter_invalid_prefixes from tests.daily.connectors.google_drive.consts_and_utils import FOLDER_1_1_FILE_IDS from tests.daily.connectors.google_drive.consts_and_utils import FOLDER_1_2_FILE_IDS from tests.daily.connectors.google_drive.consts_and_utils import FOLDER_1_FILE_IDS @@ -81,7 +82,8 @@ def assert_correct_access_for_user( all_accessible_ids = expected_access_ids + PUBLIC_RANGE expected_file_names = {file_name_template.format(i) for i in all_accessible_ids} - print_discrepencies(expected_file_names, retrieved_file_names) + filtered_retrieved_file_names = filter_invalid_prefixes(retrieved_file_names) + print_discrepencies(expected_file_names, filtered_retrieved_file_names) assert expected_file_names == retrieved_file_names @@ -172,8 +174,9 @@ def test_all_permissions( } # Should get everything - print_discrepencies(expected_file_names, found_file_names) - assert expected_file_names == found_file_names + filtered_retrieved_file_names = filter_invalid_prefixes(found_file_names) + print_discrepencies(expected_file_names, filtered_retrieved_file_names) + assert expected_file_names == filtered_retrieved_file_names group_map = get_group_map(google_drive_connector)