def get(self, id): """Return an existing limit by it's id. @type id: str @param id: Name of limit to find. @rtype: opencue.wrappers.limit.Limit @return: The limit found by id. """ return Limit( self.stub.Get(limit_pb2.LimitGetRequest(id=id), timeout=Cuebot.Timeout).limit)
def get(self, limit_id): """Returns an existing limit by its id. :type limit_id: str :param limit_id: id of limit to find :rtype: opencue.wrappers.limit.Limit :return: the limit found by id. """ return Limit( self.stub.Get(limit_pb2.LimitGetRequest(id=limit_id), timeout=Cuebot.Timeout).limit)
def testGet(self, getStubMock): stubMock = mock.Mock() stubMock.Get.return_value = limit_pb2.LimitGetResponse( limit=limit_pb2.Limit(name=TEST_LIMIT_NAME, max_value=TEST_LIMIT_MAX_VALUE)) getStubMock.return_value = stubMock limit = opencue.wrappers.limit.Limit() responseLimit = limit.get(TEST_LIMIT_ID) stubMock.Get.assert_called_with( limit_pb2.LimitGetRequest(id=TEST_LIMIT_ID), timeout=mock.ANY) self.assertEqual(responseLimit.name(), TEST_LIMIT_NAME) self.assertEqual(responseLimit.maxValue(), TEST_LIMIT_MAX_VALUE)
def _update(self): """Updates the current data object from the database.""" self.data = self.stub.Get(limit_pb2.LimitGetRequest(id=self.id()), timeout=Cuebot.Timeout)