Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
abarolo authored and abarolo committed Jul 9, 2024
1 parent cfd56da commit 7c3b384
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions api/barriers/signals/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions tests/barriers/signals/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

0 comments on commit 7c3b384

Please sign in to comment.