def getJobNames(**options): """Returns a list of job names that match the search parameters. See getJobs for the job query options. :rtype: list :return: List of matching str job names""" criteria = search.JobSearch.criteriaFromOptions(**options) return Cuebot.getStub('job').GetJobNames( job_pb2.JobGetJobNamesRequest(r=criteria), timeout=Cuebot.Timeout).names
def testGetJobNames(self, getStubMock): stubMock = mock.Mock() stubMock.GetJobNames.return_value = job_pb2.JobGetJobNamesResponse( names=[TEST_JOB_NAME]) getStubMock.return_value = stubMock jobNames = opencue.api.getJobNames(show=[TEST_SHOW_NAME]) stubMock.GetJobNames.assert_called_with( job_pb2.JobGetJobNamesRequest( r=job_pb2.JobSearchCriteria(shows=[TEST_SHOW_NAME])), timeout=mock.ANY) self.assertEqual(1, len(jobNames)) self.assertEqual(TEST_JOB_NAME, jobNames[0])