Example #1
0
    def test_input_type_default(self):
        self.mock_raw_input.return_value = ''

        expected = 1
        actual = _get_input('prompt', input_type=int, default=1)
        self.assertEqual(expected, actual)
        self.mock_raw_input.assert_called_once_with('prompt ')
Example #2
0
    def test_input_provided(self):
        self.mock_raw_input.return_value = 'test input'

        expected = 'test input'
        actual = _get_input('prompt')
        self.assertEqual(expected, actual)
        self.mock_raw_input.assert_called_once_with('prompt ')
Example #3
0
    def test_default(self):
        self.mock_raw_input.return_value = ''

        expected = 'test val'
        actual = _get_input('prompt', default='test val')
        self.assertEqual(expected, actual)
        self.mock_raw_input.assert_called_once_with('prompt ')
Example #4
0
 def test_no_input(self):
     expected = ''
     actual = _get_input('prompt')
     self.assertEqual(expected, actual)
     self.mock_raw_input.assert_called_once_with('prompt ')