def can_test_on_upstream(self): change_states = {"POST", "MODIFIED"} # With these states, the change is in upstream if self.status not in {"POST", "MODIFIED", "ON_QA", "VERIFIED", "RELEASE_PENDING"}: return False history = self.get_history_raw()["bugs"][0]["history"] changes = [] # We look for status changes in the history for event in history: for change in event["changes"]: if change["field_name"].lower() != "status": continue if change["added"] in change_states: changes.append(event["when"]) return event["when"] < appliance_build_datetime() else: return False
def can_test_on_current_upstream_appliance(self): """ This property is designed for use with the blocks property and is answering the question: "If I have a bug, and that bug is in a "POST" or "MODIFIED" state, and if I have an upstream appliance, is the build date of my current upstream appliance after the fix for the bug was merged?" If so, then it will return True, because the bug's fix is included in your current upstream appliance. If you happen to be on an older version of an upstream appliance that doesn't have the fix, then it will return False. """ bug = self.data if bug is None: # if bug is None, then it is not a blocker and we can test it return True if not bug.can_test_on_upstream: # if bug is not fixed in upstream, we can't test it! return False change_states = {"POST", "MODIFIED"} # With these states, the change is not in upstream if bug.status in {"NEW", "ON_DEV", "ASSIGNED"}: return False history = bug.get_history_raw()["bugs"][0]["history"] changes = [] # We look for status changes in the history for event in history: for change in event["changes"]: if change["field_name"].lower() != "status": continue if change["added"] in change_states: changes.append(event["when"]) return event["when"] < version.appliance_build_datetime() else: return False