Ejemplo n.º 1
0
 def test_parser_simple_link(self):
     response = HTTPResponse(200, '<a href="/index.aspx">ASP.NET</a>',
                             Headers(), self.url, self.url)
     w = WMLParser(response)
     w.parse()
     re, parsed = w.get_references()
     
     # TODO: Shouldn't this be the other way around?!
     self.assertEqual(len(parsed), 0)
     self.assertEqual(u'http://www.w3af.com/index.aspx', re[0].url_string)
Ejemplo n.º 2
0
 def test_parser_simple_form(self):
     form = """<go method="post" href="post.php">
                 <postfield name="clave" value="$(clave)"/>
                 <postfield name="cuenta" value="$(cuenta)"/>
                 <postfield name="tipdat" value="D"/>
             </go>"""
     
     response = HTTPResponse(200, form, Headers(), self.url, self.url)
     
     w = WMLParser(response)
     w.parse()
     forms = w.get_forms()
     
     self.assertEqual(len(forms), 1)
     form = forms[0]
     
     self.assertEqual(form.get_action().url_string,
                      u'http://www.w3af.com/post.php')
     
     self.assertIn('clave', form)
     self.assertIn('cuenta', form)
     self.assertIn('tipdat', form)