def test_pdf_case01(self): parser = document_parser_factory( _build_http_response( file(self.PDF_FILE).read(), u'application/pdf')) self.assertIsInstance(parser, DocumentParser) self.assertIsInstance(parser._parser, PDFParser)
def test_issue_106_invalid_url(self): ''' Issue to verify https://github.com/andresriancho/w3af/issues/106 ''' sharepoint_pl = file(self.HTML_FILE).read() parser = document_parser_factory(_build_http_response(sharepoint_pl, u'text/html')) self.assertIsInstance(parser, DocumentParser) self.assertIsInstance(parser._parser, HTMLParser) paths = [] paths.extend(url.get_path_qs() for url in parser.get_references()[0]) paths.extend(url.get_path_qs() for url in parser.get_references()[1]) expected_paths = set(['/szukaj/_vti_bin/search.asmx', '/_vti_bin/search.asmx?disco=', '/_vti_bin/search.asmx', '/2003/05/soap-envelope', '/soap/envelope/', '/2001/XMLSchema', '/2001/XMLSchema-instance']) self.assertEqual(expected_paths, set(paths))
def test_pdf_case01(self): parser = document_parser_factory( _build_http_response(file(self.PDF_FILE).read(), u'application/pdf')) self.assertIsInstance(parser, DocumentParser) self.assertIsInstance(parser._parser, PDFParser)
def test_issue_106_invalid_url(self): ''' Issue to verify https://github.com/andresriancho/w3af/issues/106 ''' sharepoint_pl = file(self.HTML_FILE).read() parser = document_parser_factory( _build_http_response(sharepoint_pl, u'text/html')) self.assertIsInstance(parser, DocumentParser) self.assertIsInstance(parser._parser, HTMLParser) paths = [] paths.extend(url.get_path_qs() for url in parser.get_references()[0]) paths.extend(url.get_path_qs() for url in parser.get_references()[1]) expected_paths = set([ '/szukaj/_vti_bin/search.asmx', '/_vti_bin/search.asmx?disco=', '/_vti_bin/search.asmx', '/2003/05/soap-envelope', '/soap/envelope/', '/2001/XMLSchema', '/2001/XMLSchema-instance' ]) self.assertEqual(expected_paths, set(paths))
def test_html(self): parser = document_parser_factory(_build_http_response( '', u'text/html')) self.assertIsInstance(parser, DocumentParser) self.assertIsInstance(parser._parser, HTMLParser)
def test_html(self): parser = document_parser_factory(_build_http_response('', u'text/html')) self.assertIsInstance(parser, DocumentParser) self.assertIsInstance(parser._parser, HTMLParser)