def create(self): """Create a new Limit from the current Limit object. @rtype: opencue.wrappers.limit.Limit @return: The newly created Limit """ return Limit( self.stub.Create(limit_pb2.LimitCreateRequest( name=self.name(), max_value=self.maxValue()), timeout=Cuebot.Timeout))
def testCreateLimit(self, getStubMock): stubMock = mock.Mock() stubMock.Create.return_value = limit_pb2.LimitCreateResponse() getStubMock.return_value = stubMock testLimitValue = 42 opencue.api.createLimit(TEST_LIMIT_NAME, testLimitValue) stubMock.Create.assert_called_with( limit_pb2.LimitCreateRequest(name=TEST_LIMIT_NAME, max_value=testLimitValue), timeout=mock.ANY)
def createLimit(name, maxValue): """Create a new Limit with the given name and max value. :type name: str :param name: the name of the new Limit :type maxValue: int :param maxValue: the maximum number of running frames for this limit :rtype: opencue.wrappers.limit.Limit :return: the newly created Limit """ return Limit(Cuebot.getStub('limit').Create( limit_pb2.LimitCreateRequest(name=name, max_value=maxValue), timeout=Cuebot.Timeout))
def testCreate(self, getStubMock): stubMock = mock.Mock() stubMock.Create.return_value = limit_pb2.LimitCreateResponse() getStubMock.return_value = stubMock limit = opencue.wrappers.limit.Limit( limit_pb2.Limit(name=TEST_LIMIT_NAME, max_value=TEST_LIMIT_MAX_VALUE)) limit.create() stubMock.Create.assert_called_with(limit_pb2.LimitCreateRequest( name=TEST_LIMIT_NAME, max_value=TEST_LIMIT_MAX_VALUE), timeout=mock.ANY)