def setName(self, name): """Sets a new name for the allocation. @type name: str @param name: the new name """ self.stub.SetName( facility_pb2.AllocSetNameRequest(allocation=self.data, name=name), timeout=Cuebot.Timeout)
def testAllocSetName(self, getStubMock): alloc = facility_pb2.Allocation(name=TEST_ALLOC_NAME) newName = 'arbitrary-name' stubMock = mock.Mock() stubMock.SetName.return_value = facility_pb2.AllocSetNameResponse() getStubMock.return_value = stubMock opencue.api.allocSetName(alloc, newName) stubMock.SetName.assert_called_with( facility_pb2.AllocSetNameRequest(allocation=alloc, name=newName), timeout=mock.ANY)
def testSetName(self, getStubMock): stubMock = mock.Mock() stubMock.SetName.return_value = facility_pb2.AllocSetNameResponse() getStubMock.return_value = stubMock alloc = opencue.wrappers.allocation.Allocation(facility_pb2.Allocation()) alloc.setName(TEST_ALLOC_NAME) stubMock.SetName.assert_called_with( facility_pb2.AllocSetNameRequest(allocation=alloc.data, name=TEST_ALLOC_NAME), timeout=mock.ANY)
def allocSetName(alloc, name): """Sets an allocation name. :type alloc: facility_pb2.Allocation :param alloc: allocation to set :type name: str :param name: new name for the allocation :rtype: facility_pb2.AllocSetNameResponse :return: empty response""" return Cuebot.getStub('allocation').SetName( facility_pb2.AllocSetNameRequest(allocation=alloc, name=name), timeout=Cuebot.Timeout)
def allocSetName(alloc, name): return Cuebot.getStub('allocation').SetName( facility_pb2.AllocSetNameRequest(allocation=alloc, name=name), timeout=Cuebot.Timeout)