diff options
author | Niels Van Och <niels.vanoch@gmail.com> | 2015-11-07 12:07:28 +0100 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2016-01-06 18:43:41 -0500 |
commit | 7f7553dd30534d606c84952a3f6dcb64b396ce37 (patch) | |
tree | b96009e4d8af11ff5b6255ccfbe9cd34214e74ed /tests/shell | |
parent | 0cc32a8f9782f0e465b4653012de9bc41e6d7db4 (diff) | |
download | django-7f7553dd30534d606c84952a3f6dcb64b396ce37.tar.gz |
Fixed #25680 -- Added django-admin shell --command option.
Add a -c option to the shell command to execute a command passed as a
string as Django.
Diffstat (limited to 'tests/shell')
-rw-r--r-- | tests/shell/__init__.py | 0 | ||||
-rw-r--r-- | tests/shell/tests.py | 19 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/shell/__init__.py b/tests/shell/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/shell/__init__.py diff --git a/tests/shell/tests.py b/tests/shell/tests.py new file mode 100644 index 0000000000..7285c968a2 --- /dev/null +++ b/tests/shell/tests.py @@ -0,0 +1,19 @@ +from django import __version__ +from django.core.management import call_command +from django.test import SimpleTestCase +from django.test.utils import patch_logger + + +class ShellCommandTestCase(SimpleTestCase): + + def test_command_option(self): + with patch_logger('test', 'info') as logger: + call_command( + 'shell', + command=( + 'import django; from logging import getLogger; ' + 'getLogger("test").info(django.__version__)' + ), + ) + self.assertEqual(len(logger), 1) + self.assertEqual(logger[0], __version__) |