0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Suppress output when running rebuild_references_index in tests

This commit is contained in:
Matt Westcott 2022-09-27 16:16:52 +01:00
parent c8689acb37
commit 5c3fb13335

View File

@ -1,5 +1,6 @@
import datetime import datetime
import json import json
from io import StringIO
from unittest import mock from unittest import mock
from django.contrib.admin.utils import quote from django.contrib.admin.utils import quote
@ -2803,7 +2804,8 @@ class TestSnippetDelete(TestCase, WagtailTestUtils):
self.assertEqual(Advert.objects.filter(text="test_advert").count(), 0) self.assertEqual(Advert.objects.filter(text="test_advert").count(), 0)
def test_usage_link(self): def test_usage_link(self):
management.call_command("rebuild_references_index") output = StringIO()
management.call_command("rebuild_references_index", stdout=output)
response = self.client.get( response = self.client.get(
reverse( reverse(
@ -3047,7 +3049,8 @@ class TestUsageCount(TestCase):
@classmethod @classmethod
def setUpTestData(cls): def setUpTestData(cls):
super().setUpTestData() super().setUpTestData()
management.call_command("rebuild_references_index") output = StringIO()
management.call_command("rebuild_references_index", stdout=output)
def test_snippet_usage_count(self): def test_snippet_usage_count(self):
advert = Advert.objects.get(pk=1) advert = Advert.objects.get(pk=1)
@ -3060,7 +3063,8 @@ class TestUsedBy(TestCase):
@classmethod @classmethod
def setUpTestData(cls): def setUpTestData(cls):
super().setUpTestData() super().setUpTestData()
management.call_command("rebuild_references_index") output = StringIO()
management.call_command("rebuild_references_index", stdout=output)
def test_snippet_used_by(self): def test_snippet_used_by(self):
advert = Advert.objects.get(pk=1) advert = Advert.objects.get(pk=1)