def testPrompt(self, raw_input_mock, print_mock):
     raw_input_mock.side_effect = ['', '42']
     self.assertEqual(
         cli_helpers.Prompt(
             'What is the ultimate meaning of life, universe and everything?'
         ), '42')
     self.assertEqual(raw_input_mock.call_count, 2)
     self.assertEqual(print_mock.call_count, 3)
Exemple #2
0
def _EnsureEditor():
    if 'EDITOR' not in os.environ:
        os.environ['EDITOR'] = cli_helpers.Prompt(
            'Looks like EDITOR environment varible is not defined. Please enter '
            'the command to view logs: ')