Skip to content

Commit

Permalink
Mock ES to prevent breaking other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkb committed Jun 24, 2024
1 parent 8cea252 commit 7737df2
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from io import StringIO
from unittest.mock import patch

from django.core.management import call_command

Expand Down Expand Up @@ -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"),
(
Expand All @@ -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)
Expand Down

0 comments on commit 7737df2

Please sign in to comment.