def check_for_comments(expected): args_template = self.args["template"] comments.cb_story(self.args) self.assertEquals(expected, self.args["template"]) comments.cb_story_end(self.args) self.assertEquals(expected, self.args["template"]) self.args["template"] = args_template
def check_for_comments(expected): args_template = self.args['template'] comments.cb_story(self.args) self.assertEquals(expected, self.args['template']) comments.cb_story_end(self.args) self.assertEquals(expected, self.args['template']) self.args['template'] = args_template
def check_comment_output(self, expected, delete_datadir=True, **kwargs): """Posts a comment and checks its rendered output. Note that this deletes the datadir before it posts the comment! """ self.data["display_comment_default"] = True self.comment(**kwargs) comments.cb_story(self.args) self.args["template"] = "" comments.cb_story_end(self.args) self.assertEquals(expected, self.args["template"]) if delete_datadir: self.delete_datadir()
def check_comment_output(self, expected, delete_datadir=True, **kwargs): """Posts a comment and checks its rendered output. Note that this deletes the datadir before it posts the comment! """ self.data['display_comment_default'] = True self.comment(**kwargs) comments.cb_story(self.args) self.args['template'] = '' comments.cb_story_end(self.args) self.assertEquals(expected, self.args['template']) if delete_datadir: self.delete_datadir()
def test_cb_story_end_renders_comments(self): self.comment() # check that cb_story_end() renders comments. self.data["display_comment_default"] = True # no comments. check both cb_story_end's return value and # args['template']. self.args["template"] = "foo" self.assertEquals("foo", comments.cb_story_end(self.args)) self.assertEquals("foo", self.args["template"]) # one comment self.renderer.flavour["comment"] = "$cmt_time " expected = "%s " % self.timestamp self.check_comment_output(expected, delete_datadir=False) # two comments self.frozen_time.timestamp += 1 expected += "%s " % self.frozen_time.timestamp self.check_comment_output(expected)
def test_cb_story_end_renders_comments(self): self.comment() # check that cb_story_end() renders comments. self.data['display_comment_default'] = True # no comments. check both cb_story_end's return value and # args['template']. self.args['template'] = 'foo' self.assertEquals('foo', comments.cb_story_end(self.args)) self.assertEquals('foo', self.args['template']) # one comment self.renderer.flavour['comment'] = '$cmt_time ' expected = '%s ' % self.timestamp self.check_comment_output(expected, delete_datadir=False) # two comments self.frozen_time.timestamp += 1 expected += '%s ' % self.frozen_time.timestamp self.check_comment_output(expected)