def test_ignore_user_error(self, mock_open_browser, *unused_mocks):
     test_io = io.TestIO()
     test_io.answers.append('Y')  # Agree to open browser to create an issue
     error = KeyError('Test KeyError')
     with self.assertRaises(KeyError):
         try:
             raise crash_handling.UserError() from error
         except Exception as e:
             crash_handling.handle_crash(e, 'command_fake', test_io)
     mock_open_browser.assert_not_called()
 def test_create_issue(self, mock_open_browser, *unused_mocks):
     test_io = io.TestIO()
     test_io.answers.append('Y')  # Agree to open browser to create an issue
     error = KeyError('Test KeyError')
     crash_handling.handle_crash(error, 'command_fake', test_io)
     self.assertEqual(mock_open_browser.call_count, 1)
     url = mock_open_browser.call_args[0][0]
     title, body = self.parse_body_and_title_from_url(url)
     self.assert_valid_issue_title(title, error)
     self.assert_valid_issue_body(body)
     self.assertIn(type(error).__name__, title)
 def test_not_creating_issue(self, mock_open_browser, *unused_mocks):
     test_io = io.TestIO()
     test_io.answers.append('N')  # Not creating Github issues
     error = KeyError('Test KeyError')
     crash_handling.handle_crash(error, 'command_fake', test_io)
     mock_open_browser.assert_not_called()