mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #35882 -- Made migration questioner loop on all errors.
This commit is contained in:
committed by
Sarah Boyce
parent
3434fab758
commit
e035db1bc3
@@ -61,10 +61,27 @@ class QuestionerHelperMethodsTests(SimpleTestCase):
|
||||
)
|
||||
|
||||
@mock.patch("builtins.input", side_effect=["bad code", "exit"])
|
||||
def test_questioner_no_default_bad_user_entry_code(self, mock_input):
|
||||
def test_questioner_no_default_syntax_error(self, mock_input):
|
||||
with self.assertRaises(SystemExit):
|
||||
self.questioner._ask_default()
|
||||
self.assertIn("Invalid input: ", self.prompt.getvalue())
|
||||
self.assertIn("SyntaxError: invalid syntax", self.prompt.getvalue())
|
||||
|
||||
@mock.patch("builtins.input", side_effect=["datetim", "exit"])
|
||||
def test_questioner_no_default_name_error(self, mock_input):
|
||||
with self.assertRaises(SystemExit):
|
||||
self.questioner._ask_default()
|
||||
self.assertIn(
|
||||
"NameError: name 'datetim' is not defined", self.prompt.getvalue()
|
||||
)
|
||||
|
||||
@mock.patch("builtins.input", side_effect=["datetime.dat", "exit"])
|
||||
def test_questioner_no_default_attribute_error(self, mock_input):
|
||||
with self.assertRaises(SystemExit):
|
||||
self.questioner._ask_default()
|
||||
self.assertIn(
|
||||
"AttributeError: module 'datetime' has no attribute 'dat'",
|
||||
self.prompt.getvalue(),
|
||||
)
|
||||
|
||||
@mock.patch("builtins.input", side_effect=[KeyboardInterrupt()])
|
||||
def test_questioner_no_default_keyboard_interrupt(self, mock_input):
|
||||
|
||||
Reference in New Issue
Block a user