Fixed #30595 -- Added error message when no objects found to sql* management commands.

This commit is contained in:
Hasan Ramezani 2019-06-30 01:35:48 +02:00 committed by Mariusz Felisiak
parent c2f381ef17
commit 5d03f2bc01
9 changed files with 38 additions and 1 deletions

View file

@ -0,0 +1,18 @@
import io
from django.core.management import call_command
from django.test import TestCase
class CoreCommandsNoOutputTests(TestCase):
available_apps = ['empty_models']
def test_sqlflush_no_tables(self):
err = io.StringIO()
call_command('sqlflush', stderr=err)
self.assertEqual(err.getvalue(), 'No tables found.\n')
def test_sqlsequencereset_no_sequences(self):
err = io.StringIO()
call_command('sqlsequencereset', 'empty_models', stderr=err)
self.assertEqual(err.getvalue(), 'No sequences found.\n')