示例#1
0
    def test_breaks_from_add_bowler_loop_when_no_name_entered(self, add_bowler, input_mock):

        name_list = ['aaron', 'dave', '']
        def side_effect(*args):
            return name_list.pop(0) if name_list else ''


        input_mock.side_effect=side_effect

        lane = BowlingLane()
        lane.prompt_for_bowlers()

        self.assertEqual(3, input_mock.call_count)
        self.assertEqual([
            (('aaron',), {}),
            (('dave',), {}),
        ], add_bowler.call_args_list)
示例#2
0
 def test_calls_add_bowler_4_times_with_valid_raw_input_value(self, add_bowler, input_mock):
     lane = BowlingLane()
     lane.prompt_for_bowlers()
     add_bowler.assert_called_with(input_mock.return_value)
     self.assertEqual(4, add_bowler.call_count)
示例#3
0
    def test_does_not_call_add_bowler_when_no_input_value(self, add_bowler, input_mock):
        input_mock.return_value = ''

        lane = BowlingLane()
        lane.prompt_for_bowlers()
        self.assertFalse(add_bowler.called)
示例#4
0
 def test_prompts_for_name_when_prompt_for_bowlers_called(self, input_mock):
     lane = BowlingLane()
     lane.prompt_for_bowlers()
     input_mock.assert_called_with(ADD_BOWLER_PROMPT)