def test_auto_confirm_without_assume_yes(self):
     cancel_possibilities = (False, '', 0)
     for value in cancel_possibilities:
         confirm = Confirm(value)
         confirm.input = MagicMock()
         self.assertFalse(confirm.ask(), value)
 def test_no_auto_confirm_when_something_else(self):
     possibilities = ('x', 0, 1, '', None, False)
     confirm = Confirm()
     confirm.input = MagicMock(side_effect=possibilities)
     for user_input in possibilities:
         self.assertFalse(confirm.ask(), user_input)
 def test_no_auto_confirm_lower(self):
     confirm = Confirm()
     confirm.input = MagicMock(return_value='y')
     self.assertTrue(confirm.ask())
示例#4
0
 def test_auto_confirm_without_assume_yes(self):
     cancel_possibilities = (False, '', 0)
     for value in cancel_possibilities:
         confirm = Confirm(value)
         confirm.input = MagicMock()
         self.assertFalse(confirm.ask(), value)
示例#5
0
 def test_no_auto_confirm_when_something_else(self):
     possibilities = ('x', 0, 1, '', None, False)
     confirm = Confirm()
     confirm.input = MagicMock(side_effect=possibilities)
     for user_input in possibilities:
         self.assertFalse(confirm.ask(), user_input)
示例#6
0
 def test_no_auto_confirm_lower(self):
     confirm = Confirm()
     confirm.input = MagicMock(return_value='y')
     self.assertTrue(confirm.ask())