From bb40ae8c3e7ee73a330bc85aafe037a76ca4d92a Mon Sep 17 00:00:00 2001 From: John Nagro Date: Fri, 12 Jan 2024 14:53:30 +0000 Subject: [PATCH] fix: ent cat resource tweaks --- .../apps/catalog/management/commands/reindex_algolia.py | 5 +++-- .../management/commands/tests/test_reindex_algolia.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/enterprise_catalog/apps/catalog/management/commands/reindex_algolia.py b/enterprise_catalog/apps/catalog/management/commands/reindex_algolia.py index d75d24a09..e2c6145e4 100644 --- a/enterprise_catalog/apps/catalog/management/commands/reindex_algolia.py +++ b/enterprise_catalog/apps/catalog/management/commands/reindex_algolia.py @@ -50,8 +50,9 @@ def handle(self, *args, **options): logger.info( 'index_enterprise_catalog_in_algolia_task launching synchronously.' ) - # For some reason in order to call a celery task in-memory you must pass kwargs as args. - index_enterprise_catalog_in_algolia_task(force_task_execution, dry_run) + index_enterprise_catalog_in_algolia_task.apply( + kwargs={'force': force_task_execution, 'dry_run': dry_run} + ) else: index_enterprise_catalog_in_algolia_task.apply_async( kwargs={'force': force_task_execution, 'dry_run': dry_run} diff --git a/enterprise_catalog/apps/catalog/management/commands/tests/test_reindex_algolia.py b/enterprise_catalog/apps/catalog/management/commands/tests/test_reindex_algolia.py index ae8aaa8a9..4fd2fad58 100644 --- a/enterprise_catalog/apps/catalog/management/commands/tests/test_reindex_algolia.py +++ b/enterprise_catalog/apps/catalog/management/commands/tests/test_reindex_algolia.py @@ -45,7 +45,7 @@ def test_reindex_algolia_no_async(self, mock_command_config, mock_task): 'no_async': True, } call_command(self.command_name) - mock_task.assert_called_once_with(False, False) # force=False, dry_run=False + mock_task.apply.assert_called_once_with(kwargs={'force': False, 'dry_run': False}) # force=False, dry_run=False mock_task.apply_async.assert_not_called() @mock.patch(PATH_PREFIX + 'index_enterprise_catalog_in_algolia_task')