mirror of
https://github.com/django/django.git
synced 2025-11-02 04:48:33 +00:00
Fixed #23303 -- Added BEGIN and COMMIT statements to the output of sqlmigrate.
This commit is contained in:
parent
b6aa60f425
commit
5853c87a45
7 changed files with 38 additions and 2 deletions
10
tests/user_commands/management/commands/transaction.py
Normal file
10
tests/user_commands/management/commands/transaction.py
Normal file
|
|
@ -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!'
|
||||
|
|
@ -134,6 +134,11 @@ class CommandTests(SimpleTestCase):
|
|||
with self.assertRaises(CommandError):
|
||||
management.call_command('hal', stdout=out)
|
||||
|
||||
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):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue