def getComments(self): """returns the hosts comments""" response = self.stub.GetComments( host_pb2.HostGetCommentsRequest(host=self.data), timeout=Cuebot.Timeout) commentSeq = response.comments return [comment.Comment(c) for c in commentSeq.comments]
def getComments(self): """Returns the host's comment list. :rtype: list<opencue.wrappers.comment.Comment> :return: the comment list of the host """ response = self.stub.GetComments( host_pb2.HostGetCommentsRequest(host=self.data), timeout=Cuebot.Timeout) commentSeq = response.comments return [ opencue.wrappers.comment.Comment(c) for c in commentSeq.comments ]
def testGetComments(self, getStubMock): message = 'this is a test.' stubMock = mock.Mock() stubMock.GetComments.return_value = host_pb2.HostGetCommentsResponse( comments=comment_pb2.CommentSeq( comments=[comment_pb2.Comment(message=message)])) getStubMock.return_value = stubMock host = opencue.wrappers.host.Host(host_pb2.Host(name=TEST_HOST_NAME)) comments = host.getComments() stubMock.GetComments.assert_called_with( host_pb2.HostGetCommentsRequest(host=host.data), timeout=mock.ANY) self.assertEqual(len(comments), 1) self.assertEqual(comments[0].message(), message)