Ejemplo n.º 1
0
 def addComment(self, subject, message):
     """Appends a comment to the hosts'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(host_pb2.HostAddCommentRequest(
         host=self.data, new_comment=comment),
                          timeout=Cuebot.Timeout)
Ejemplo n.º 2
0
    def testAddComment(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.AddComment.return_value = host_pb2.HostAddCommentResponse()
        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)
        host = opencue.wrappers.host.Host(host_pb2.Host(name=TEST_HOST_NAME))
        host.addComment(subject, message)

        stubMock.AddComment.assert_called_with(host_pb2.HostAddCommentRequest(
            host=host.data, new_comment=comment),
                                               timeout=mock.ANY)