diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2014-08-16 17:21:14 +0200 |
|---|---|---|
| committer | Baptiste Mispelon <bmispelon@gmail.com> | 2014-08-18 19:36:34 +0200 |
| commit | 3a80189479a29220bac6d205a1b97184bd76a876 (patch) | |
| tree | 308dac3d060cb4b1bbbe7b78fbd576273fbdd0ec /tests/user_commands | |
| parent | 126606c5b8499830cd56cbe632f6af17bc7471ea (diff) | |
[1.7.x] Fixed #23303 -- Added BEGIN and COMMIT statements to the output of sqlmigrate.
Backport of 5853c87a458f62ebd62d7809168355610de2570c from master.
Conflicts:
django/core/management/commands/sqlmigrate.py
tests/user_commands/tests.py
Diffstat (limited to 'tests/user_commands')
| -rw-r--r-- | tests/user_commands/management/commands/transaction.py | 10 | ||||
| -rw-r--r-- | tests/user_commands/tests.py | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/user_commands/management/commands/transaction.py b/tests/user_commands/management/commands/transaction.py new file mode 100644 index 0000000000..ca531b2b97 --- /dev/null +++ b/tests/user_commands/management/commands/transaction.py @@ -0,0 +1,10 @@ +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + help = "Say hello." + args = '' + output_transaction = True + + def handle(self, *args, **options): + return 'Hello!' diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py index c24a6e7a2d..1d405bec1c 100644 --- a/tests/user_commands/tests.py +++ b/tests/user_commands/tests.py @@ -74,6 +74,11 @@ class CommandTests(SimpleTestCase): if current_path is not None: os.environ['PATH'] = current_path + def test_output_transaction(self): + out = StringIO() + management.call_command('transaction', stdout=out, no_color=True) + self.assertEqual(out.getvalue(), 'BEGIN;\nHello!\n\nCOMMIT;\n') + class UtilsTests(SimpleTestCase): |
