def test_saving_a_comment_is_stored(self):
#submit a comment to /share_key/save_comment
body = """This is a comment.
A multi-line comment.&
That is all.&_xsrf=asdf
"""
request = HTTPRequest(self.get_url('/p/%s/comment' % self.shf.share_key), 'POST', {'Cookie':'_xsrf=%s;sid=%s' % (self.xsrf, self.sid)}, "body=%s&_xsrf=%s" % (url_escape(body), self.xsrf))
self.http_client.fetch(request, self.stop)
response = self.wait()
comments = self.shf.comments()
self.assertEqual(len(comments), 1)
self.assertEqual(comments[0].body, body.strip())
评论列表
文章目录