def _fetch(self, inset=None): """ Fetch currently linked test cases from the server """ # If data initialized from the inset ---> we're done if Container._fetch(self, inset): return # Initialize all plan-case tags (skip when caching persistently # as this an additional/unnecessary call in that case) if config.get_cache_level() == config.CACHE_OBJECTS: log.info("Fetching tags for all {0}'s test cases".format(self._object.identifier)) for tag in self._server.TestPlan.get_all_cases_tags(self.id): Tag(tag) # Fetch test cases from the server log.info("Fetching {0}'s cases".format(self._identifier)) injects = self._server.TestPlan.get_test_cases(self.id) log.data("Fetched {0}".format(listed(injects, "inject"))) self._current = set([TestCase(inject) for inject in injects]) self._original = set(self._current) # Initialize case plans if not already cached if not PlanCasePlans._is_cached(self._object.caseplans): inset = [ CasePlan( { # Fake our own internal id from testplan & testcase "id": _idify([self._object.id, inject["case_id"]]), "case_id": inject["case_id"], "plan_id": self._object.id, "sortkey": inject["sortkey"], } ) for inject in injects ] self._object.caseplans._fetch(inset)
def _fetch(self, inset=None): """ Fetch currently linked test cases from the server """ # If data initialized from the inset ---> we're done if Container._fetch(self, inset): return # Initialize all plan-case tags (skip when caching persistently # as this an additional/unnecessary call in that case) if config.get_cache_level() == config.CACHE_OBJECTS: log.info("Fetching tags for all {0}'s test cases".format( self._object.identifier)) for tag in self._server.TestPlan.get_all_cases_tags(self.id): Tag(tag) # Fetch test cases from the server log.info("Fetching {0}'s cases".format(self._identifier)) injects = self._server.TestPlan.get_test_cases(self.id) log.data("Fetched {0}".format(listed(injects, "inject"))) self._current = set([TestCase(inject) for inject in injects]) self._original = set(self._current) # Initialize case plans if not already cached if not PlanCasePlans._is_cached(self._object.caseplans): inset = [ CasePlan({ # Fake our own internal id from testplan & testcase "id": _idify([self._object.id, inject["case_id"]]), "case_id": inject["case_id"], "plan_id": self._object.id, "sortkey": inject["sortkey"] }) for inject in injects ] self._object.caseplans._fetch(inset)
def __hash__(self): """ Construct the uniqe hash from bug id and bug system id """ return _idify([self.system, self.bug])