예제 #1
0
 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))
예제 #2
0
    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)
예제 #3
0
파일: api.py 프로젝트: vishnu-rai/OpenCue
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))
예제 #4
0
    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)