From 7737df2022f6ba8f425b702f082d3504849918ad Mon Sep 17 00:00:00 2001 From: Dhruv Bhanushali Date: Mon, 24 Jun 2024 21:30:10 +0400 Subject: [PATCH] Mock ES to prevent breaking other tests --- .../management/commands/test_backfillmoderationdecision.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/test/unit/management/commands/test_backfillmoderationdecision.py b/api/test/unit/management/commands/test_backfillmoderationdecision.py index 4c4e91cc88d..d4b66ebffd0 100644 --- a/api/test/unit/management/commands/test_backfillmoderationdecision.py +++ b/api/test/unit/management/commands/test_backfillmoderationdecision.py @@ -1,4 +1,5 @@ from io import StringIO +from unittest.mock import patch from django.core.management import call_command @@ -44,6 +45,7 @@ def make_reports(media_type, reason: str, status: str, count: int = 1): return ImageReportFactory.create_batch(count, status=status, reason=reason) +@patch("django.conf.settings.ES") @pytest.mark.parametrize( ("reason", "status", "expected_action"), ( @@ -61,7 +63,7 @@ def make_reports(media_type, reason: str, status: str, count: int = 1): @pytest.mark.parametrize(("media_type"), ("image", "audio")) @pytest.mark.django_db def test_create_moderation_decision_for_reports( - media_type, reason, status, expected_action + mock_es, media_type, reason, status, expected_action ): username = "opener" UserFactory.create(username=username)