mirror of
https://github.com/django/django.git
synced 2025-11-01 20:31:40 +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:
parent
03aec35a12
commit
c296e55dc6
7 changed files with 96 additions and 7 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue