def getRenderPartitions(self): """Returns a list of render partitions associated with this host @rtype: list<RenderPartition> @return: A list of render partitions under this host """ response = self.stub.GetRenderPartitions(host_pb2.HostGetRenderPartitionsRequest( host=self.data), timeout=Cuebot.Timeout) partitionSeq = response.render_partitions return partitionSeq.render_partitions
def testGetRenderPartitions(self, getStubMock): renderPartId = 'rpr-rprp-rpr' stubMock = mock.Mock() stubMock.GetRenderPartitions.return_value = host_pb2.HostGetRenderPartitionsResponse( render_partitions=renderPartition_pb2.RenderPartitionSeq( render_partitions=[renderPartition_pb2.RenderPartition(id=renderPartId)])) getStubMock.return_value = stubMock host = opencue.wrappers.host.Host( host_pb2.Host(name=TEST_HOST_NAME)) renderParts = host.getRenderPartitions() stubMock.GetRenderPartitions.assert_called_with( host_pb2.HostGetRenderPartitionsRequest(host=host.data), timeout=mock.ANY) self.assertEqual(len(renderParts), 1) self.assertEqual(renderParts[0].id, renderPartId)