Beispiel #1
0
 def test_form_post(self):
     html = '<form method="POST">%s<input name="age" value=""/></form>'
     injector = FormTokenInjector('123123', io.StringIO())
     injector.feed(html % '')
     injector.close()
     html %= ('<input type="hidden" name="__FORM_TOKEN" value="%s"/>' %
              injector.token)
     self.assertEqual(html, injector.out.getvalue())
Beispiel #2
0
 def test_form_get(self):
     html = '<form method="get"><input name="age" value=""/></form>'
     injector = FormTokenInjector('123123', io.StringIO())
     injector.feed(html)
     injector.close()
     self.assertEqual(html, injector.out.getvalue())
Beispiel #3
0
 def test_no_form(self):
     html = '<div><img src="trac.png"/></div>'
     injector = FormTokenInjector('123123', io.StringIO())
     injector.feed(html)
     injector.close()
     self.assertEqual(html, injector.out.getvalue())