Ejemplo n.º 1
0
 def getDepends(self):
     """Returns a list of all depends this job is involved with
     @rtype:  list<Depend>
     @return: all depends involved with this job"""
     response = self.stub.GetDepends(
         job_pb2.JobGetDependsRequest(job=self.data),
         timeout=Cuebot.Timeout)
     dependSeq = response.depends
     return [depend.Depend(depend) for depend in dependSeq.depends]
Ejemplo n.º 2
0
    def testGetDepends(self, getStubMock):
        dependId = 'ddd-dddd-ddd'
        stubMock = mock.Mock()
        stubMock.GetDepends.return_value = job_pb2.JobGetDependsResponse(
            depends=depend_pb2.DependSeq(
                depends=[depend_pb2.Depend(id=dependId)]))
        getStubMock.return_value = stubMock

        job = opencue.wrappers.job.Job(job_pb2.Job(name=TEST_JOB_NAME))
        depends = job.getDepends()

        stubMock.GetDepends.assert_called_with(
            job_pb2.JobGetDependsRequest(job=job.data), timeout=mock.ANY)
        self.assertEqual(len(depends), 1)
        self.assertEqual(depends[0].id(), dependId)