Skip to content

Commit

Permalink
fix: Fixed broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IrfanUddinAhmad committed Nov 7, 2023
1 parent 32ffbcb commit 72330ca
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions enterprise_catalog/apps/api/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 72330ca

Please sign in to comment.