From 72330cae7e557e2cb6efdd6676a33809a7133c36 Mon Sep 17 00:00:00 2001 From: IrfanUddinAhmad Date: Tue, 7 Nov 2023 19:43:46 +0500 Subject: [PATCH] fix: Fixed broken tests --- .../apps/api/tests/test_tasks.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/enterprise_catalog/apps/api/tests/test_tasks.py b/enterprise_catalog/apps/api/tests/test_tasks.py index 347fe209b..317c9c159 100644 --- a/enterprise_catalog/apps/api/tests/test_tasks.py +++ b/enterprise_catalog/apps/api/tests/test_tasks.py @@ -795,7 +795,7 @@ def mock_replace_all_objects(products_iterable): tasks.index_enterprise_catalog_in_algolia_task() # pylint: disable=no-value-for-parameter products_found_log_records = [record for record in info_logs.output if ' products found.' in record] - assert ' 15 products found.' in products_found_log_records[0] + assert ' 16 products found.' in products_found_log_records[0] # create expected data to be added/updated in the Algolia index. expected_program_1_objects_to_index = [] @@ -887,7 +887,7 @@ def mock_replace_all_objects(products_iterable): tasks.index_enterprise_catalog_in_algolia_task() # pylint: disable=no-value-for-parameter products_found_log_records = [record for record in info_logs.output if ' products found.' in record] - assert ' 12 products found.' in products_found_log_records[0] + assert ' 13 products found.' in products_found_log_records[0] # assert the program was not indexed. program_uuid = program_1.json_metadata.get('uuid') @@ -985,7 +985,7 @@ def mock_replace_all_objects(products_iterable): tasks.index_enterprise_catalog_in_algolia_task() # pylint: disable=no-value-for-parameter products_found_log_records = [record for record in info_logs.output if ' products found.' in record] - assert ' 6 products found.' in products_found_log_records[0] + assert ' 8 products found.' in products_found_log_records[0] # create expected data to be added/updated in the Algolia index. expected_course_1_objects_to_index = [] @@ -1081,7 +1081,7 @@ def mock_replace_all_objects(products_iterable): tasks.index_enterprise_catalog_in_algolia_task() # pylint: disable=no-value-for-parameter products_found_log_records = [record for record in info_logs.output if ' products found.' in record] - assert ' 6 products found.' in products_found_log_records[0] + assert ' 8 products found.' in products_found_log_records[0] # create expected data to be added/updated in the Algolia index. expected_course_1_objects_to_index = [] @@ -1165,7 +1165,7 @@ def mock_replace_all_objects(products_iterable): tasks.index_enterprise_catalog_in_algolia_task() # pylint: disable=no-value-for-parameter products_found_log_records = [record for record in info_logs.output if ' products found.' in record] - assert ' 6 products found.' in products_found_log_records[0] + assert ' 8 products found.' in products_found_log_records[0] # create expected data to be added/updated in the Algolia index. expected_course_1_objects_to_index = [] @@ -1256,7 +1256,7 @@ def mock_replace_all_objects(products_iterable): tasks.index_enterprise_catalog_in_algolia_task() # pylint: disable=no-value-for-parameter products_found_log_records = [record for record in info_logs.output if ' products found.' in record] - assert ' 6 products found.' in products_found_log_records[0] + assert ' 8 products found.' in products_found_log_records[0] # create expected data to be added/updated in the Algolia index. expected_course_1_objects_to_index = [] @@ -1357,7 +1357,7 @@ def mock_replace_all_objects(products_iterable): tasks.index_enterprise_catalog_in_algolia_task() # pylint: disable=no-value-for-parameter products_found_log_records = [record for record in info_logs.output if ' products found.' in record] - assert ' 9 products found.' in products_found_log_records[0] + assert ' 12 products found.' in products_found_log_records[0] # create expected data to be added/updated in the Algolia index. expected_course_1_objects_to_index = [] @@ -1510,7 +1510,7 @@ def mock_replace_all_objects(products_iterable): tasks.index_enterprise_catalog_in_algolia_task() # pylint: disable=no-value-for-parameter products_found_log_records = [record for record in info_logs.output if ' products found.' in record] - assert ' 15 products found.' in products_found_log_records[0] + assert ' 20 products found.' in products_found_log_records[0] # create expected data to be added/updated in the Algolia index. expected_algolia_objects_to_index = [] @@ -1643,7 +1643,7 @@ def mock_replace_all_objects(products_iterable): with self.assertLogs(level='INFO') as info_logs: tasks.index_enterprise_catalog_in_algolia_task() # pylint: disable=no-value-for-parameter - assert ' 6 products found.' in info_logs.output[-1] + assert ' 7 products found.' in info_logs.output[-1] # create expected data to be added/updated in the Algolia index. expected_algolia_objects_to_index = [] @@ -1709,7 +1709,7 @@ def mock_replace_all_objects(products_iterable): with self.assertLogs(level='INFO') as info_logs: tasks.index_enterprise_catalog_in_algolia_task() # pylint: disable=no-value-for-parameter - assert ' 6 products found.' in info_logs.output[-1] + assert ' 7 products found.' in info_logs.output[-1] # create expected data to be added/updated in the Algolia index. expected_algolia_objects_to_index = [] @@ -1805,7 +1805,7 @@ def test_index_algolia_dry_run(self, mock_search_client): tasks.index_enterprise_catalog_in_algolia_task(force, dry_run) mock_search_client().replace_all_objects.assert_not_called() - assert '[ENTERPRISE_CATALOG_ALGOLIA_REINDEX] [DRY RUN] 6 products found.' in info_logs.output[-1] + assert '[ENTERPRISE_CATALOG_ALGOLIA_REINDEX] [DRY RUN] 7 products found.' in info_logs.output[-1] assert any( '[ENTERPRISE_CATALOG_ALGOLIA_REINDEX] [DRY RUN] skipping algolia_client.replace_all_objects().' in record for record in info_logs.output