def test_parse_mks_response_for_mks_id(self): self.assertEquals( MKSIntegrity()._parse_mks_response_for_mks_id( self._example_mks_response), 732916) self.assertEquals( MKSIntegrity()._parse_mks_response_for_mks_id( self._example_mks_response_with_decoded_html_entities), 732916)
def begin_work_queue(self): AbstractQueue.begin_work_queue(self) # FIXME: We should find a better place to put this code so that we instantiate # a RIMBugzilla and MKSIntegrity instance with the dryrun paramater instead of # overridding the passed Bugzilla instance in self.tool.bugs. dryrun = self.tool.bugs.dryrun; self.tool.bugs = RIMBugzilla(dryrun=dryrun) self.mksintegrity = MKSIntegrity(dryrun=dryrun)
def begin_work_queue(self): # FIXME: We provide a mock status server object since we aren't running a # status server like http://queues.webkit.org. self._tool.status_server = Mock(); AbstractQueue.begin_work_queue(self) # FIXME: We should find a better place to put this code so that we instantiate # a RIMBugzilla and MKSIntegrity instance with the dryrun paramater instead of # overridding the passed Bugzilla instance in self._tool.bugs. dryrun = self._tool.bugs.dryrun; self._tool.bugs = RIMBugzilla(dryrun=dryrun) self.mksintegrity = MKSIntegrity(dryrun=dryrun)
class NeedsMKSQueue(AbstractQueue, StepSequenceErrorHandler): name = "rim-needs-mks-queue" def __init__(self): AbstractQueue.__init__(self) # AbstractQueue methods def begin_work_queue(self): # FIXME: We provide a mock status server object since we aren't running a # status server like http://queues.webkit.org. self._tool.status_server = Mock(); AbstractQueue.begin_work_queue(self) # FIXME: We should find a better place to put this code so that we instantiate # a RIMBugzilla and MKSIntegrity instance with the dryrun paramater instead of # overridding the passed Bugzilla instance in self._tool.bugs. dryrun = self._tool.bugs.dryrun; self._tool.bugs = RIMBugzilla(dryrun=dryrun) self.mksintegrity = MKSIntegrity(dryrun=dryrun) def next_work_item(self): bug_ids = self._tool.bugs.needs_mks() all_bugs = [self._tool.bugs.fetch_bug(bug_id) for bug_id in bug_ids] if (all_bugs): return all_bugs[0] return None def should_proceed_with_work_item(self, bug): return True def work_item_log_path(self, bug): return os.path.join(self._log_directory(), "%s.log" % bug.id()) def process_work_item(self, bug): mks_id = self.mksintegrity.create_bug(MKSBug(bug)) self._tool.bugs.substitute_keyword(bug.id(), "NeedsMKS", "InMKS") self._tool.bugs.post_comment_to_bug(bug.id(), "MKS Bug #%d <http://mksintegrity:7001/im/viewissue?selection=%d>" % (mks_id, mks_id)) return True def handle_unexpected_error(self, bug, message): print "Error when handling bug #%d: %s" % (bug.id(), message) # StepSequenceErrorHandler methods @classmethod def handle_script_error(cls, tool, state, script_error): # FIXME: We need to make this error message more informative. print "Script error occurred."
class NeedsMKSQueue(AbstractQueue, StepSequenceErrorHandler): name = "rim-needs-mks-queue" def __init__(self): AbstractQueue.__init__(self) # AbstractQueue methods def begin_work_queue(self): AbstractQueue.begin_work_queue(self) # FIXME: We should find a better place to put this code so that we instantiate # a RIMBugzilla and MKSIntegrity instance with the dryrun paramater instead of # overridding the passed Bugzilla instance in self.tool.bugs. dryrun = self.tool.bugs.dryrun; self.tool.bugs = RIMBugzilla(dryrun=dryrun) self.mksintegrity = MKSIntegrity(dryrun=dryrun) def next_work_item(self): bug_ids = self.tool.bugs.needs_mks() all_bugs = [self.tool.bugs.fetch_bug(bug_id) for bug_id in bug_ids] if (all_bugs): return all_bugs[0] return None def should_proceed_with_work_item(self, bug): return True def work_item_log_path(self, bug): return os.path.join(self._log_directory(), "%s.log" % bug.id()) def process_work_item(self, bug): mks_id = self.mksintegrity.create_bug(MKSBug(bug)) self.tool.bugs.substitute_keyword(bug.id(), "NeedsMKS", "InMKS") self.tool.bugs.post_comment_to_bug(bug.id(), "MKS Bug #%d <http://mksintegrity:7001/im/viewissue?selection=%d>" % (mks_id, mks_id)) return True def handle_unexpected_error(self, bug, message): print "Error when handling bug #%d: %s" % (bug.id(), message) # StepSequenceErrorHandler methods @classmethod def handle_script_error(cls, tool, state, script_error): # FIXME: We need to make this error message more informative. print "Script error occurred."
def test_create_mks_request(self): mks_request = MKSIntegrity()._create_mks_request( bug_title="Example Bug", bug_description="This is an example bug.", component="Browser", sub_component="WebKit", build_type="Development/Test", build_version="n/a", component_targeted_release="6.0.0", has_ui_impact="No", reproducible="Yes", frequency_of_occurrence="Frequent", issue_type="", handheld_discovered_on="ExampleDevice", reporter="a_person", reporter_email="*****@*****.**", issue_owner="a_person", assignee="+Assign Developer") self.assertEquals(mks_request, self._expected_mks_request)