mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #22258 -- Added progress status for dumpdata when outputting to file
Thanks Gwildor Sok for the report and Tim Graham for the review.
This commit is contained in:
@@ -9,6 +9,7 @@ from datetime import datetime
|
||||
from xml.dom import minidom
|
||||
|
||||
from django.core import management, serializers
|
||||
from django.core.serializers.base import ProgressBar
|
||||
from django.db import connection, transaction
|
||||
from django.test import (
|
||||
SimpleTestCase, TestCase, TransactionTestCase, mock, override_settings,
|
||||
@@ -188,6 +189,16 @@ class SerializersTestBase(object):
|
||||
mv_obj = obj_list[0].object
|
||||
self.assertEqual(mv_obj.title, movie_title)
|
||||
|
||||
def test_serialize_progressbar(self):
|
||||
fake_stdout = StringIO()
|
||||
serializers.serialize(
|
||||
self.serializer_name, Article.objects.all(),
|
||||
progress_output=fake_stdout, object_count=Article.objects.count()
|
||||
)
|
||||
self.assertTrue(
|
||||
fake_stdout.getvalue().endswith('[' + '.' * ProgressBar.progress_width + ']\n')
|
||||
)
|
||||
|
||||
def test_serialize_superfluous_queries(self):
|
||||
"""Ensure no superfluous queries are made when serializing ForeignKeys
|
||||
|
||||
|
||||
Reference in New Issue
Block a user