From 5d03f2bc01fc08f57558cdd3b4fc08e6b379dad7 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sun, 30 Jun 2019 01:35:48 +0200 Subject: Fixed #30595 -- Added error message when no objects found to sql* management commands. --- tests/empty_models/__init__.py | 0 tests/empty_models/models.py | 0 tests/empty_models/test_commands.py | 18 ++++++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 tests/empty_models/__init__.py create mode 100644 tests/empty_models/models.py create mode 100644 tests/empty_models/test_commands.py (limited to 'tests/empty_models') diff --git a/tests/empty_models/__init__.py b/tests/empty_models/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/empty_models/models.py b/tests/empty_models/models.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/empty_models/test_commands.py b/tests/empty_models/test_commands.py new file mode 100644 index 0000000000..5dd4744033 --- /dev/null +++ b/tests/empty_models/test_commands.py @@ -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') -- cgit v1.3