def testIdOnEntityList(self, getStubMock): del getStubMock arbitraryIds = ['foo', 'bar'] jobs = [Job(job_pb2.Job(id=arbitraryIds[0])), Job(job_pb2.Job(id=arbitraryIds[1]))] ids = opencue.id(jobs) self.assertEqual(len(jobs), len(ids)) for i in range(0, len(jobs)): self.assertEqual(arbitraryIds[i], ids[i])
def __processUpdateHandleNested(self, parent, groups): """Adds or updates self._items from a list of NestedGroup objects. @type parent: QTreeWidgetItem or QTreeWidget @param parent: The parent item for this level of items @type groups: list<NestedGroup> @param groups: paramB_description""" for group in groups: # If id already exists, update it if group.data.parent.id: parent = self._items.get(group.data.parent.id) if group.id() in self._items: groupItem = self._items[group.id()] groupItem.update(group, parent) elif group.data.parent.id: self._items[group.id()] = groupItem = GroupWidgetItem( group, parent) else: self._items[group.id()] = groupItem = RootGroupWidgetItem( group, parent) nestedGroups = [ opencue.wrappers.group.NestedGroup(nestedGroup) for nestedGroup in group.data.groups.nested_groups ] self.__processUpdateHandleNested(groupItem, nestedGroups) # empty list will return all jobs on the farm # only search if list has jobs if group.data.jobs: jobSeq = opencue.search.JobSearch.byOptions( id=list(group.data.jobs)).jobs jobsObject = [Job(j) for j in jobSeq.jobs] for job in jobsObject: try: if job.id() in self._items: self._items[job.id()].update(job, groupItem) else: self._items[job.id()] = JobWidgetItem( job, groupItem) except RuntimeError: logger.warning( "Failed to create tree item. RootView might be closed", exc_info=True)
def testIdOnEntity(self, getStubMock): del getStubMock arbitraryId = 'foo' job = Job(job_pb2.Job(id=arbitraryId)) self.assertEqual(arbitraryId, opencue.id(job))
def testIdOnEntity(self): arbitraryId = 'foo' job = Job(job_pb2.Job(id=arbitraryId)) self.assertEquals(arbitraryId, opencue.id(job))