def findFilter(self, name): """Find the filter by name @type: string @param: name of filter to find @rtype: Filter @return: filter wrapper of found filter """ response = self.stub.FindFilter(show_pb2.ShowFindFilterRequest( show=self.data, name=name), timeout=Cuebot.Timeout) return opencue.wrappers.filter.Filter(response.filter)
def findFilter(self, name): """Finds a filter by name. :type name: string :param name: name of filter to find :rtype: opencue.wrappers.filter.Filter :return: matching filter """ response = self.stub.FindFilter(show_pb2.ShowFindFilterRequest( show=self.data, name=name), timeout=Cuebot.Timeout) return opencue.wrappers.filter.Filter(response.filter)
def testFindFilter(self, getStubMock): stubMock = mock.Mock() stubMock.FindFilter.return_value = show_pb2.ShowFindFilterResponse( filter=filter_pb2.Filter(name=TEST_FILTER_NAME)) getStubMock.return_value = stubMock show = opencue.wrappers.show.Show(show_pb2.Show(name=TEST_SHOW_NAME)) filter_found = show.findFilter(TEST_FILTER_NAME) stubMock.FindFilter.assert_called_with(show_pb2.ShowFindFilterRequest( show=show.data, name=TEST_FILTER_NAME), timeout=mock.ANY) self.assertEqual(filter_found.name(), TEST_FILTER_NAME)