1- from dojo .models import Test
21from dojo .tools .rusty_hog .parser import RustyhogParser
32from unittests .dojo_test_case import DojoTestCase , get_unit_tests_scans_path
43
@@ -7,25 +6,25 @@ class TestRustyhogParser(DojoTestCase):
76 def test_parse_file_with_no_vuln_has_no_finding_choctawhog (self ):
87 with open (get_unit_tests_scans_path ("rusty_hog" ) / "choctawhog_no_vuln.json" , encoding = "utf-8" ) as testfile :
98 parser = RustyhogParser ()
10- findings = parser .get_items (testfile , "Rusty Hog" , Test () ) # The outputfile is empty. A subscanner can't be classified
9+ findings = parser .get_findings (testfile , "Rusty Hog" ) # The outputfile is empty. A subscanner can't be classified
1110 self .assertEqual (0 , len (findings ))
1211
1312 def test_parse_file_with_one_vuln_has_one_finding_choctawhog (self ):
1413 with open (get_unit_tests_scans_path ("rusty_hog" ) / "choctawhog_one_vuln.json" , encoding = "utf-8" ) as testfile :
1514 parser = RustyhogParser ()
16- findings = parser .get_items (testfile , "Choctaw Hog" , Test () )
15+ findings = parser .get_findings (testfile , "Choctaw Hog" )
1716 self .assertEqual (1 , len (findings ))
1817
1918 def test_parse_file_with_multiple_vuln_has_multiple_finding_choctawhog (self ):
2019 with open (get_unit_tests_scans_path ("rusty_hog" ) / "choctawhog_many_vulns.json" , encoding = "utf-8" ) as testfile :
2120 parser = RustyhogParser ()
22- findings = parser .get_items (testfile , "Choctaw Hog" , Test () )
21+ findings = parser .get_findings (testfile , "Choctaw Hog" )
2322 self .assertEqual (13 , len (findings ))
2423
2524 def test_parse_file_with_multiple_vuln_has_multiple_finding_choctawhog_content (self ):
2625 with open (get_unit_tests_scans_path ("rusty_hog" ) / "choctawhog_many_vulns.json" , encoding = "utf-8" ) as testfile :
2726 parser = RustyhogParser ()
28- findings = parser .get_items (testfile , "Choctaw Hog" , Test () )
27+ findings = parser .get_findings (testfile , "Choctaw Hog" )
2928 self .assertEqual (findings [0 ].title , "Email address found in Git path .github/workflows/main.yml (a7bce96377c4ff2ac16cd51fb0da7fe7ea678829)" )
3029 self .assertIn ("**This string was found:** ['dojo-helpers@this-repo.com']" , findings [0 ].description )
3130 self .assertIn ("**Commit message:** removing action" , findings [0 ].description )
@@ -38,25 +37,25 @@ def test_parse_file_with_multiple_vuln_has_multiple_finding_choctawhog_content(s
3837 def test_parse_file_with_no_vuln_has_no_finding_duorchog (self ):
3938 with open (get_unit_tests_scans_path ("rusty_hog" ) / "durochog_no_vuln.json" , encoding = "utf-8" ) as testfile :
4039 parser = RustyhogParser ()
41- findings = parser .get_items (testfile , "Rusty Hog" , Test () ) # The outputfile is empty. A subscanner can't be classified
40+ findings = parser .get_findings (testfile , "Rusty Hog" ) # The outputfile is empty. A subscanner can't be classified
4241 self .assertEqual (0 , len (findings ))
4342
4443 def test_parse_file_with_one_vuln_has_one_finding_durochog (self ):
4544 with open (get_unit_tests_scans_path ("rusty_hog" ) / "durochog_one_vuln.json" , encoding = "utf-8" ) as testfile :
4645 parser = RustyhogParser ()
47- findings = parser .get_items (testfile , "Duroc Hog" , Test () )
46+ findings = parser .get_findings (testfile , "Duroc Hog" )
4847 self .assertEqual (1 , len (findings ))
4948
5049 def test_parse_file_with_multiple_vuln_has_multiple_finding_durochog (self ):
5150 with open (get_unit_tests_scans_path ("rusty_hog" ) / "durochog_many_vulns.json" , encoding = "utf-8" ) as testfile :
5251 parser = RustyhogParser ()
53- findings = parser .get_items (testfile , "Duroc Hog" , Test () )
52+ findings = parser .get_findings (testfile , "Duroc Hog" )
5453 self .assertEqual (4 , len (findings ))
5554
5655 def test_parse_file_with_multiple_vuln_has_multiple_finding_durochog_content (self ):
5756 with open (get_unit_tests_scans_path ("rusty_hog" ) / "durochog_many_vulns.json" , encoding = "utf-8" ) as testfile :
5857 parser = RustyhogParser ()
59- findings = parser .get_items (testfile , "Duroc Hog" , Test () )
58+ findings = parser .get_findings (testfile , "Duroc Hog" )
6059 self .assertEqual (findings [0 ].title , "password (Password) found in path /scan_folder/unittests/scans/sonarqube/sonar-no-finding.html" )
6160 self .assertIn ("**This string was found:** ['password = getEncryptedPass()']" , findings [0 ].description )
6261 self .assertIn ("**Path of Issue:** /scan_folder/unittests/scans/sonarqube/sonar-no-finding.html" , findings [0 ].description )
@@ -67,25 +66,25 @@ def test_parse_file_with_multiple_vuln_has_multiple_finding_durochog_content(sel
6766 def test_parse_file_with_no_vuln_has_no_finding_gottingenhog (self ):
6867 with open (get_unit_tests_scans_path ("rusty_hog" ) / "gottingenhog_no_vuln.json" , encoding = "utf-8" ) as testfile :
6968 parser = RustyhogParser ()
70- findings = parser .get_items (testfile , "Rusty Hog" , Test () ) # The outputfile is empty. A subscanner can't be classified
69+ findings = parser .get_findings (testfile , "Rusty Hog" ) # The outputfile is empty. A subscanner can't be classified
7170 self .assertEqual (0 , len (findings ))
7271
7372 def test_parse_file_with_one_vuln_has_one_finding_gottingenhog (self ):
7473 with open (get_unit_tests_scans_path ("rusty_hog" ) / "gottingenhog_one_vuln.json" , encoding = "utf-8" ) as testfile :
7574 parser = RustyhogParser ()
76- findings = parser .get_items (testfile , "Gottingen Hog" , Test () )
75+ findings = parser .get_findings (testfile , "Gottingen Hog" )
7776 self .assertEqual (1 , len (findings ))
7877
7978 def test_parse_file_with_multiple_vuln_has_multiple_finding_gottingenhog (self ):
8079 with open (get_unit_tests_scans_path ("rusty_hog" ) / "gottingenhog_many_vulns.json" , encoding = "utf-8" ) as testfile :
8180 parser = RustyhogParser ()
82- findings = parser .get_items (testfile , "Gottingen Hog" , Test () )
81+ findings = parser .get_findings (testfile , "Gottingen Hog" )
8382 self .assertEqual (10 , len (findings ))
8483
8584 def test_parse_file_with_multiple_vuln_has_multiple_finding_gottingenhog_content (self ):
8685 with open (get_unit_tests_scans_path ("rusty_hog" ) / "gottingenhog_many_vulns.json" , encoding = "utf-8" ) as testfile :
8786 parser = RustyhogParser ()
88- findings = parser .get_items (testfile , "Gottingen Hog" , Test () )
87+ findings = parser .get_findings (testfile , "Gottingen Hog" )
8988 self .assertEqual (findings [0 ].title , "password found in Jira ID TEST-123 (Issue Description)" )
9089 self .assertIn ("**This string was found:** ['password: jeans']" , findings [0 ].description )
9190 self .assertIn ("**JIRA Issue ID:** TEST-123" , findings [0 ].description )
@@ -96,19 +95,19 @@ def test_parse_file_with_multiple_vuln_has_multiple_finding_gottingenhog_content
9695 def test_parse_file_with_no_vuln_has_no_finding_essexhog (self ):
9796 with open (get_unit_tests_scans_path ("rusty_hog" ) / "essexhog_no_vuln.json" , encoding = "utf-8" ) as testfile :
9897 parser = RustyhogParser ()
99- findings = parser .get_items (testfile , "Rusty Hog" , Test () ) # The outputfile is empty. A subscanner can't be classified
98+ findings = parser .get_findings (testfile , "Rusty Hog" ) # The outputfile is empty. A subscanner can't be classified
10099 self .assertEqual (0 , len (findings ))
101100
102101 def test_parse_file_with_one_vuln_has_one_finding_essexhog (self ):
103102 with open (get_unit_tests_scans_path ("rusty_hog" ) / "essexhog_one_vuln.json" , encoding = "utf-8" ) as testfile :
104103 parser = RustyhogParser ()
105- findings = parser .get_items (testfile , "Essex Hog" , Test () )
104+ findings = parser .get_findings (testfile , "Essex Hog" )
106105 self .assertEqual (1 , len (findings ))
107106
108107 def test_parse_file_with_multiple_vuln_has_multiple_finding_essexhog (self ):
109108 with open (get_unit_tests_scans_path ("rusty_hog" ) / "essexhog_many_vulns.json" , encoding = "utf-8" ) as testfile :
110109 parser = RustyhogParser ()
111- findings = parser .get_items (testfile , "Essex Hog" , Test () )
110+ findings = parser .get_findings (testfile , "Essex Hog" )
112111 self .assertEqual (3 , len (findings ))
113112 self .assertEqual ("https://confluence.com/pages/viewpage.action?pageId=12345" , findings [0 ].file_path )
114113 self .assertEqual ("['-----BEGIN EC PRIVATE KEY-----']" , findings [0 ].payload )
@@ -117,7 +116,7 @@ def test_parse_file_with_multiple_vuln_has_multiple_finding_essexhog(self):
117116 def test_parse_file_with_multiple_vuln_has_multiple_finding_essexhog_content (self ):
118117 with open (get_unit_tests_scans_path ("rusty_hog" ) / "essexhog_many_vulns.json" , encoding = "utf-8" ) as testfile :
119118 parser = RustyhogParser ()
120- findings = parser .get_items (testfile , "Essex Hog" , Test () )
119+ findings = parser .get_findings (testfile , "Essex Hog" )
121120 self .assertEqual (findings [0 ].title , "SSH (EC) private key found in Confluence Page ID 12345" )
122121 self .assertIn ("-----BEGIN EC PRIVATE KEY-----" , findings [0 ].description )
123122 self .assertIn ("**Confluence URL:** [https://confluence.com/pages/viewpage.action?pageId=12345](https://confluence.com/pages/viewpage.action?pageId=12345)" , findings [0 ].description )
0 commit comments