def getProcs(self): """Returns a list of procs under this host. @rtype: list<Proc> @return: A list of procs under this host """ response = self.stub.GetProcs(host_pb2.HostGetProcsRequest(host=self.data), timeout=Cuebot.Timeout) return [opencue.wrappers.proc.Proc(p) for p in response.procs.procs]
def testGetProcs(self, getStubMock): procName = 'testProc' stubMock = mock.Mock() stubMock.GetProcs.return_value = host_pb2.HostGetProcsResponse( procs=host_pb2.ProcSeq(procs=[host_pb2.Proc(name=procName)])) getStubMock.return_value = stubMock host = opencue.wrappers.host.Host(host_pb2.Host(name=TEST_HOST_NAME)) procs = host.getProcs() stubMock.GetProcs.assert_called_with( host_pb2.HostGetProcsRequest(host=host.data), timeout=mock.ANY) self.assertEqual(len(procs), 1) self.assertEqual(procs[0].name(), procName)