Exemplo n.º 1
0
 def test_can_replace_default_prompt_for_string_input(self):
     handler = InputHandler()
     handler.start(string_prompt='a')
     handler.input_string()
     handler.input_string('b')
     handler.end()
     self.m1.assert_any_call('a')
     self.m1.assert_any_call('b')
Exemplo n.º 2
0
 def test_can_set_several_default_prompts_for_inputs(self):
     handler = InputHandler()
     handler.start(number_prompt='a',
                   password_prompt='b',
                   string_prompt='c')
     handler.input_number()
     handler.input_password()
     handler.input_string()
     handler.end()
     self.m1.assert_any_call('a')
     self.m1.assert_any_call('c')
     self.m2.assert_called_once_with('b')
Exemplo n.º 3
0
 def check(s):
     self.m1.reset_mock()
     self.m1.return_value = s
     handler = InputHandler()
     handler.start()
     res = handler.input_string()
     handler.end()
     return res
Exemplo n.º 4
0
 def test_can_set_nondefault_prompt_for_string_input(self):
     handler = InputHandler()
     handler.start()
     handler.input_string('a')
     handler.end()
     self.m1.assert_called_once_with('a')