def test_url_args_not_modified(self): """ Setting the proper arguments turns off automatic args addition. """ url = BugzillaURL(url=self.bzurl) args = url._get_bz_args(open_only=False, scrum_only=False) ok_('bug_status' not in args) ok_('status_whiteboard' not in args)
def test_url_args_override_defaults(self): """ You should still be able to specify your own statuses and whiteboard. """ url = BugzillaURL(url=self.bzurl + ';bug_status=CLOSED' ';status_whiteboard=u%3Dthedude') args = url._get_bz_args() eq_(args['bug_status'], 'CLOSED') eq_(args['status_whiteboard'], 'u=thedude')
def test_bz_args(self): """ args should be added for bug status and whiteboard :return: """ statuses = set(['UNCONFIRMED', 'ASSIGNED', 'REOPENED', 'NEW']) url = BugzillaURL(url=self.bzurl) args = url._get_bz_args() self.assertSetEqual(set(args.getlist('bug_status')), statuses) eq_(args['status_whiteboard'], 'u= c= p=')
def forwards(self, orm): print ' - Importing sprint data from Bugzilla.' print ' - ', for sprint in Sprint.objects.all(): if sprint.bz_url: bzurl = BugzillaURL(url=sprint.bz_url) bugs = bzurl.get_bugs(scrum_only=False, open_only=False) for bug in bugs: # at this point project and sprint ids are equal bug.project_id = bug.backlog_id = sprint.team_id bug.sprint = sprint bug.save() sys.stdout.write('.') sys.stdout.flush() print '\n - Done.'
def sync_old_sprints(): """ Get the bugs from sprints with bugzilla urls and associate them properly. """ for sprint in Sprint.objects.all(): if sprint.bz_url: bzurl = BugzillaURL(url=sprint.bz_url) bugs = bzurl.get_bugs(scrum_only=False, open_only=False) for bug in bugs: # at this point project and sprint ids are equal bug.project_id = bug.backlog_id = sprint.team_id bug.sprint = sprint bug.save() sys.stdout.write('.') sys.stdout.flush() print '\nDone.'
def sync_bugmail(): """ Check bugmail for updated bugs, and get their data from Bugzilla. """ bugids = get_bugmails() if bugids: numbugs = len(bugids) url = BugzillaURL(url=get_bz_url_for_bug_ids(bugids)) try: url.get_bugs(open_only=False) except BZError: # error logged in `get_bugs` log.error('Failed to update bugs from email: %s', bugids) return if NEW_RELIC: newrelic.agent.record_custom_metric('Custom/Bugmails', numbugs) log.info('Synced %d bug(s) from email', numbugs)
def sync_bugmail(): """ Check bugmail for updated bugs, and get their data from Bugzilla. """ counter = 0 bugids = get_bugmails() for slug, ids in bugids.items(): counter += len(ids) url = BugzillaURL(url=get_bz_url_for_bug_ids(ids)) proj = None if slug: try: proj = Project.objects.get(slug=slug) except Project.DoesNotExist: pass if proj: url.project = proj url.get_bugs() sys.stdout.write('.') sys.stdout.flush() if counter: print "\nSynced {0} bugs".format(counter)