def createDependencyOnJob(self, job): """Create and return a frame on job dependency @type job: opencue.wrappers.job.Job @param job: the job you want this frame to depend on @rtype: opencue.wrappers.depend.Depend @return: The new dependency""" response = self.stub.CreateDependencyOnJob( job_pb2.FrameCreateDependencyOnJobRequest(frame=self.data, job=job.data), timeout=Cuebot.Timeout) return opencue.wrappers.depend.Depend(response.depend)
def testCreateDependencyOnJob(self, getStubMock): dependId = 'ddd-dddd-ddd' stubMock = mock.Mock() stubMock.CreateDependencyOnJob.return_value = \ job_pb2.FrameCreateDependencyOnJobResponse(depend=depend_pb2.Depend(id=dependId)) getStubMock.return_value = stubMock dependJobName = 'jobDependTest' frame = opencue.wrappers.frame.Frame( job_pb2.Frame(name=TEST_FRAME_NAME, state=job_pb2.RUNNING)) dependOnJob = opencue.wrappers.job.Job(job_pb2.Job(name=dependJobName)) depend = frame.createDependencyOnJob(dependOnJob) stubMock.CreateDependencyOnJob.assert_called_with( job_pb2.FrameCreateDependencyOnJobRequest(frame=frame.data, job=dependOnJob.data), timeout=mock.ANY) self.assertEqual(depend.id(), dependId)