def test_parser_simple_link(self): response = HTTPResponse( 200, '<a href="/index.aspx">ASP.NET</a>', Headers(), self.url, self.url ) w = WMLParser( response ) 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)
def test_parser_simple_link(self): response = HTTPResponse(200, '<a href="/index.aspx">ASP.NET</a>', Headers(), self.url, self.url) w = WMLParser(response) 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)
def test_parser_re_link(self): '''Get a link by applying regular expressions''' response = HTTPResponse(200, 'header /index.aspx footer', Headers(), self.url, self.url) w = WMLParser( response ) re, parsed = w.get_references() # TODO: Shouldn't this be the other way around?! self.assertEqual([], re) self.assertEqual(len(parsed), 1) self.assertEqual(u'http://www.w3af.com/index.aspx', parsed[0].url_string)
def test_parser_re_link(self): '''Get a link by applying regular expressions''' response = HTTPResponse(200, 'header /index.aspx footer', Headers(), self.url, self.url) w = WMLParser(response) re, parsed = w.get_references() # TODO: Shouldn't this be the other way around?! self.assertEqual([], re) self.assertEqual(len(parsed), 1) self.assertEqual(u'http://www.w3af.com/index.aspx', parsed[0].url_string)
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) 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)
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) 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)