0
0
mirror of https://github.com/django/django.git synced 2024-11-21 10:59:04 +01:00

Refs #35882 -- Added test for migration questioner KeyboardInterrupt.

This commit is contained in:
Adam Johnson 2024-11-18 14:41:24 +01:00 committed by Sarah Boyce
parent ca113adbae
commit 3434fab758

View File

@ -66,6 +66,11 @@ class QuestionerHelperMethodsTests(SimpleTestCase):
self.questioner._ask_default()
self.assertIn("Invalid input: ", self.prompt.getvalue())
@mock.patch("builtins.input", side_effect=[KeyboardInterrupt()])
def test_questioner_no_default_keyboard_interrupt(self, mock_input):
with self.assertRaises(KeyboardInterrupt):
self.questioner._ask_default()
@mock.patch("builtins.input", side_effect=["", "n"])
def test_questioner_no_default_no_user_entry_boolean(self, mock_input):
value = self.questioner._boolean_input("Proceed?")