Exemplo n.º 1
0
Arquivo: test_ptp.py Projeto: owtf/ptp
 def test_ptp_no_cumulative_parsing(self):
     my_ptp = PTP(cumulative=False)
     my_ptp.parser = MockParserInfo()  # Tool 1, first run
     report = my_ptp.parse()
     assert_that(1, equal_to(len(report)))
     assert_that(report, has_item({'ranking': constants.INFO}))
     assert_that(report, is_not(has_item({'ranking': constants.HIGH})))
     my_ptp.parser = MockParserHigh()  # Tool 2, second run
     report = my_ptp.parse()
     assert_that(1, equal_to(len(report)))
     assert_that(report, has_item({'ranking': constants.HIGH}))
     assert_that(report, is_not(has_item({'ranking': constants.INFO})))
Exemplo n.º 2
0
 def test_ptp_no_cumulative_parsing(self):
     my_ptp = PTP(cumulative=False)
     my_ptp.parser = MockParserInfo()  # Tool 1, first run
     report = my_ptp.parse()
     assert_that(1, equal_to(len(report)))
     assert_that(report, has_item({'ranking': constants.INFO}))
     assert_that(report, is_not(has_item({'ranking': constants.HIGH})))
     my_ptp.parser = MockParserHigh()  # Tool 2, second run
     report = my_ptp.parse()
     assert_that(1, equal_to(len(report)))
     assert_that(report, has_item({'ranking': constants.HIGH}))
     assert_that(report, is_not(has_item({'ranking': constants.INFO})))
Exemplo n.º 3
0
Arquivo: test_ptp.py Projeto: owtf/ptp
 def test_ptp_parse_mock_parser(self):
     my_ptp = PTP()
     my_ptp.parser = MockParser()
     vulns = my_ptp.parse()
     self.assertEqual(vulns, [])
     self.assertEqual(my_ptp.tool_name, 'mock')
     self.assertEqual(my_ptp.metadata, {})
Exemplo n.º 4
0
 def test_ptp_parse_mock_parser(self):
     my_ptp = PTP()
     my_ptp.parser = MockParser()
     vulns = my_ptp.parse()
     self.assertEqual(vulns, [])
     self.assertEqual(my_ptp.tool_name, 'mock')
     self.assertEqual(my_ptp.metadata, {})
Exemplo n.º 5
0
Arquivo: test_ptp.py Projeto: owtf/ptp
 def test_ptp_no_light_parsing(self):
     my_ptp = PTP()
     my_ptp.parser = MockParserLight
     report = my_ptp.parse(light=False)
     assert_that(1, equal_to(len(report)))
     vuln = report[0]
     # In heavy parsing mode, there is a finding with UNKNOWN ranking that will contain all the transactions that
     # could not be assigned to other vuln when parsing the report
     self.assertTrue('ranking' in vuln and vuln['ranking'] == constants.UNKNOWN)
     self.assertTrue('transactions' in vuln and len(vuln['transactions']))
Exemplo n.º 6
0
 def test_ptp_no_light_parsing(self):
     my_ptp = PTP()
     my_ptp.parser = MockParserLight
     report = my_ptp.parse(light=False)
     assert_that(1, equal_to(len(report)))
     vuln = report[0]
     # In heavy parsing mode, there is a finding with UNKNOWN ranking that will contain all the transactions that
     # could not be assigned to other vuln when parsing the report
     self.assertTrue('ranking' in vuln
                     and vuln['ranking'] == constants.UNKNOWN)
     self.assertTrue('transactions' in vuln and len(vuln['transactions']))
Exemplo n.º 7
0
Arquivo: test_ptp.py Projeto: owtf/ptp
 def test_ptp_light_parsing(self):
     my_ptp = PTP()
     my_ptp.parser = MockParserLight
     report = my_ptp.parse(light=True)
     assert_that(0, equal_to(len(report)))  # In light mode, the mock parser has no findings.
Exemplo n.º 8
0
 def test_ptp_light_parsing(self):
     my_ptp = PTP()
     my_ptp.parser = MockParserLight
     report = my_ptp.parse(light=True)
     assert_that(0, equal_to(
         len(report)))  # In light mode, the mock parser has no findings.