Beispiel #1
0
 def test_promptyn_default(self, prompt):
     """ Prompt user for y/n user default on no input """
     prompt.return_value = ''
     ret = scripts.promptyn('', True)
     self.assertTrue(ret)
     ret = scripts.promptyn('', False)
     self.assertFalse(ret)
Beispiel #2
0
 def test_promptyn_default(self, prompt):
     """ Prompt user for y/n user default on no input """
     prompt.return_value = ''
     ret = scripts.promptyn('', True)
     self.assertTrue(ret)
     ret = scripts.promptyn('', False)
     self.assertFalse(ret)
Beispiel #3
0
 def test_promptyn_no_default(self, prompt):
     """ Prompt user for y/n requires an answer """
     invals = ['', '42', 'yeees', 'wat', '1', 'no']
     prompt.side_effect = lambda *_, **__: invals.pop(0)
     ret = scripts.promptyn('')
     self.assertEqual(len(invals), 0)
     self.assertFalse(ret)
Beispiel #4
0
 def test_promptyn_no_default(self, prompt):
     """ Prompt user for y/n requires an answer """
     invals = ["", "42", "yeees", "wat", "1", "no"]
     prompt.side_effect = lambda *_, **__: invals.pop(0)
     ret = scripts.promptyn("")
     self.assertEqual(len(invals), 0)
     self.assertFalse(ret)
Beispiel #5
0
 def test_promptyn_no_default(self, prompt):
     """ Prompt user for y/n requires an answer """
     invals = ['', '42', 'yeees', 'wat', '1', 'no']
     prompt.side_effect = lambda *_, **__: invals.pop(0)
     ret = scripts.promptyn('')
     self.assertEqual(len(invals), 0)
     self.assertFalse(ret)
Beispiel #6
0
 def test_promptyn_no(self, prompt):
     """ Prompt user for y/n user says no """
     prompt.return_value = 'n'
     ret = scripts.promptyn('')
     self.assertFalse(ret)
Beispiel #7
0
 def test_promptyn_yes(self, prompt):
     """ Prompt user for y/n user says yes """
     prompt.return_value = 'y'
     ret = scripts.promptyn('')
     self.assertTrue(ret)
Beispiel #8
0
 def test_promptyn_no(self, prompt):
     """ Prompt user for y/n user says no """
     prompt.return_value = 'n'
     ret = scripts.promptyn('')
     self.assertFalse(ret)
Beispiel #9
0
 def test_promptyn_yes(self, prompt):
     """ Prompt user for y/n user says yes """
     prompt.return_value = 'y'
     ret = scripts.promptyn('')
     self.assertTrue(ret)