diff --git a/api/barriers/signals/handlers.py b/api/barriers/signals/handlers.py index a28847cf..35343ff0 100644 --- a/api/barriers/signals/handlers.py +++ b/api/barriers/signals/handlers.py @@ -213,8 +213,8 @@ def related_barrier_update_embeddings(sender, instance, *args, **kwargs): # Fail gracefully client.get_related_barriers( pk=str(current_barrier_object.id), - title=current_barrier_object.title, - summary=current_barrier_object.summary, + title=instance.title, + summary=instance.summary, ) except Exception as e: # We don't want barrier embedding updates to break worker so just log error diff --git a/tests/barriers/signals/test_handlers.py b/tests/barriers/signals/test_handlers.py index b72507ce..5c59d10d 100644 --- a/tests/barriers/signals/test_handlers.py +++ b/tests/barriers/signals/test_handlers.py @@ -9,8 +9,10 @@ def test_related_barrier_handler(): barrier = BarrierFactory() - with mock.patch("api.barriers.signals.handlers.manager") as mock_manager: + with mock.patch("api.barriers.signals.handlers.client") as mock_client: barrier.title = "New Title" barrier.save() - assert mock_manager.manager.update_barrier.call_count == 1 + mock_client.get_related_barriers.assert_called_once_with( + pk=str(barrier.pk), title=barrier.title, summary=barrier.summary + )