def getWhatThisDependsOn(self): """Get a list of dependencies that this layer depends on @rtype: list<opencue.depend.Depend> @return: List of dependences that this layer depends on""" response = self.stub.GetWhatThisDependsOn( job_pb2.LayerGetWhatThisDependsOnRequest(layer=self.data), timeout=Cuebot.Timeout) dependSeq = response.depends return [opencue.wrappers.depend.Depend(dep) for dep in dependSeq.depends]
def testGetWhatThisDependsOn(self, getStubMock): dependId = 'dddd-ddd-dddd' stubMock = mock.Mock() stubMock.GetWhatThisDependsOn.return_value = job_pb2.LayerGetWhatThisDependsOnResponse( depends=depend_pb2.DependSeq(depends=[depend_pb2.Depend(id=dependId)])) getStubMock.return_value = stubMock layer = opencue.wrappers.layer.Layer( job_pb2.Layer(name=TEST_LAYER_NAME)) depends = layer.getWhatThisDependsOn() stubMock.GetWhatThisDependsOn.assert_called_with( job_pb2.LayerGetWhatThisDependsOnRequest(layer=layer.data), timeout=mock.ANY) self.assertEqual(len(depends), 1) self.assertEqual(depends[0].id(), dependId)