コード例 #1
0
    def test_handle_confirmation__cancel(self, mock_input, mock_cancel):
        mock_input.return_value = 'Q'
        test_ui = UI()

        with self.assertRaises(SystemExit):
            test_ui._handle_confirmation()

        mock_cancel.assert_called_once()
コード例 #2
0
    def test_handle_confirmation__restart(self, mock_input, mock_cancel):
        mock_input.return_value = 'R'
        test_ui = UI()

        with self.assertRaises(UserRequestedRestart):
            test_ui._handle_confirmation()

        mock_cancel.assert_not_called()
コード例 #3
0
    def test_handle_confirmation__ok(self, mock_input, mock_cancel):
        mock_input.return_value = ''
        test_ui = UI()

        test_ui._handle_confirmation()
        mock_cancel.assert_not_called()