1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #32900 -- Added test for ignoring the default value in InteractiveMigrationQuestioner.ask_not_null_alteration().

This commit is contained in:
Mateo Radman 2021-07-17 10:46:24 +03:00 committed by Mariusz Felisiak
parent d1216e126f
commit d00fb4d2d6

View File

@ -4,6 +4,7 @@ from unittest import mock
from django.db.migrations.questioner import (
InteractiveMigrationQuestioner, MigrationQuestioner,
)
from django.db.models import NOT_PROVIDED
from django.test import SimpleTestCase
from django.test.utils import captured_stdout, override_settings
@ -23,3 +24,10 @@ class QuestionerTests(SimpleTestCase):
with captured_stdout():
value = questioner._ask_default()
self.assertEqual(value, datetime.timedelta(days=1))
@mock.patch('builtins.input', return_value='2')
def test_ask_not_null_alteration_not_provided(self, mock):
questioner = InteractiveMigrationQuestioner()
with captured_stdout():
question = questioner.ask_not_null_alteration('field_name', 'model_name')
self.assertEqual(question, NOT_PROVIDED)