Esempio n. 1
0
 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()
Esempio n. 2
0
 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()
Esempio n. 3
0
 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()
Esempio n. 4
0
 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()
Esempio n. 5
0
 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
Esempio n. 6
0
 def setUp(self):
     self.post = Post(title='example post', body='**markdown**')
     self.form_class = modelform_factory(Post)