예제 #1
0
파일: job.py 프로젝트: xinobi/OpenCue
 def addComment(self, subject, message):
     """Appends a comment to the job's comment list
     @type  subject: str
     @param subject: Subject data
     @type  message: str
     @param message: Message data"""
     comment = comment_pb2.Comment(user=os.getenv("USER", "unknown"),
                                   subject=subject,
                                   message=message or " ",
                                   timestamp=0)
     self.stub.AddComment(job_pb2.JobAddCommentRequest(job=self.data,
                                                       new_comment=comment),
                          timeout=Cuebot.Timeout)
예제 #2
0
    def testAddComment(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.AddComment.return_value = job_pb2.JobAddCommentResponse()
        getStubMock.return_value = stubMock

        subject = 'test'
        message = 'this is a test.'
        comment = comment_pb2.Comment(user=os.getenv('USER', 'unknown'), subject=subject,
                                      message=message, timestamp=0)
        job = opencue.wrappers.job.Job(
            job_pb2.Job(name=TEST_JOB_NAME))
        job.addComment(subject, message)

        stubMock.AddComment.assert_called_with(
            job_pb2.JobAddCommentRequest(job=job.data, new_comment=comment),
            timeout=mock.ANY)