def _report_exception(self, edata, eid, num, total): """ Report one or more bugs to w3af's Github, submit data to server. """ try: gh = GithubIssues(OAUTH_TOKEN) gh.login() except LoginFailed: msg = 'Failed to contact github.com. Please try again later.' om.out.console(msg) except OAuthTokenInvalid: om.out.console(OAUTH_AUTH_FAILED) else: traceback_str = edata.traceback_str desc = edata.get_summary() plugins = edata.enabled_plugins summary = str(edata.exception) ticket_id, ticket_url = gh.report_bug(summary, desc, tback=traceback_str, plugins=plugins) if ticket_id is None: fmt = ' [%s/%s] Failed to report bug with id %s.' msg = fmt % (num, total, eid) else: fmt = ' [%s/%s] Bug with id %s reported at %s' msg = fmt % (num, total, eid, ticket_url) om.out.console(str(msg))
def _report_exception(self, edata, eid, num, total): """ Report one or more bugs to w3af's Github, submit data to server. """ gh = GithubIssues(OAUTH_TOKEN) if not gh.login(): msg = 'Failed to contact github.com. Please try again later.' om.out.console(msg) else: traceback_str = edata.traceback_str desc = edata.get_summary() plugins = edata.enabled_plugins summary = str(edata.exception) ticket_id, ticket_url = gh.report_bug(summary, desc, tback=traceback_str, plugins=plugins) if ticket_id is None: msg = ' [%s/%s] Failed to report bug with id %s.' % ( num, total, eid) else: msg = ' [%s/%s] Bug with id %s reported at %s' % ( num, total, eid, ticket_url) om.out.console(str(msg))
def test_report(self): gh = GithubIssues(OAUTH_TOKEN) gh.login() summary = 'Unittest bug report' userdesc = 'Please remove this ticket' ticket_id, ticket_url = gh.report_bug(summary, userdesc) self.assertIsInstance(ticket_id, int) self.assertTrue(ticket_url.startswith( 'https://github.com/andresriancho/w3af/issues/')) # Remove the ticket I've just created gh = Github(OAUTH_TOKEN) repo = gh.get_user('andresriancho').get_repo('w3af') issue = repo.get_issue(ticket_id) issue.edit(state='closed')