コード例 #1
0
ファイル: job.py プロジェクト: xinobi/OpenCue
 def getComments(self):
     """returns the jobs comments"""
     response = self.stub.GetComments(
         job_pb2.JobGetCommentsRequest(job=self.data),
         timeout=Cuebot.Timeout)
     commentSeq = response.comments
     return [comment.Comment(cmt) for cmt in commentSeq.comments]
コード例 #2
0
    def getComments(self):
        """Returns the job's comment list.

        :rtype: list<opencue.wrappers.comment.Comment>
        :return: the job's comment list
        """
        response = self.stub.GetComments(
            job_pb2.JobGetCommentsRequest(job=self.data),
            timeout=Cuebot.Timeout)
        commentSeq = response.comments
        return [
            opencue.wrappers.comment.Comment(cmt)
            for cmt in commentSeq.comments
        ]
コード例 #3
0
    def testGetComments(self, getStubMock):
        message = 'this is a test.'
        stubMock = mock.Mock()
        stubMock.GetComments.return_value = job_pb2.JobGetCommentsResponse(
            comments=comment_pb2.CommentSeq(
                comments=[comment_pb2.Comment(message=message)]))
        getStubMock.return_value = stubMock

        job = opencue.wrappers.job.Job(job_pb2.Job(name=TEST_JOB_NAME))
        comments = job.getComments()

        stubMock.GetComments.assert_called_with(
            job_pb2.JobGetCommentsRequest(job=job.data), timeout=mock.ANY)
        self.assertEqual(len(comments), 1)
        self.assertEqual(comments[0].message(), message)