def setUp(self): self.xss_str = "<script>alert('xss');</script>" self.mp = Post( title="example markdown post", body="**markdown**", body_markup_type="markdown", ) self.mp.save() self.rp = Post( title="example restructuredtext post", body="*ReST*", body_markup_type="ReST", ) self.rp.save() self.xss_post = Post( title="example xss post", body=self.xss_str, body_markup_type="markdown", comment=self.xss_str, ) self.xss_post.save() self.plain_str = ('<span style="color: red">plain</span> post\n\n' "http://example.com") self.pp = Post( title="example plain post", body=self.plain_str, body_markup_type="plain", comment=self.plain_str, comment_markup_type="plain", ) self.pp.save()
def setUp(self): self.mp = Post(title='example markdown post', body='**markdown**', body_markup_type='text/x-markdown') self.mp.save() self.rp = Post(title='example restructuredtext post', body='*ReST*', body_markup_type='ReST') self.rp.save()
def setUp(self): self.xss_str = "<script>alert('xss');</script>" self.mp = Post(title='example markdown post', body='**markdown**', body_markup_type='markdown') self.mp.save() self.rp = Post(title='example restructuredtext post', body='*ReST*', body_markup_type='ReST') self.rp.save() self.xss_post = Post(title='example xss post', body=self.xss_str, body_markup_type='markdown', comment=self.xss_str) self.xss_post.save()
def setUp(self): self.xss_str = "<script>alert('xss');</script>" self.mp = Post(title='example markdown post', body='**markdown**', body_markup_type='markdown') self.mp.save() self.rp = Post(title='example restructuredtext post', body='*ReST*', body_markup_type='ReST') self.rp.save() self.xss_post = Post(title='example xss post', body=self.xss_str, body_markup_type='markdown', comment=self.xss_str) self.xss_post.save() self.plain_str = ('<span style="color: red">plain</span> post\n\n' 'http://example.com') self.pp = Post(title='example plain post', body=self.plain_str, body_markup_type='plain', comment=self.plain_str, comment_markup_type='plain') self.pp.save()
def test_markup_bool(self): # ensure that __bool__ functions as expected p = Post( title="example empty", body="", body_markup_type="plain", comment=":)", comment_markup_type="markdown", ) assert bool(p.body) is False assert bool(p.comment) is True
def setUp(self): self.post = Post(title='example post', body='**markdown**') self.form_class = modelform_factory(Post)