def test_generate_report(self): shutil.copyfile('./tests/mock_files/dependency-check-report.json', '/tmp/dependency-check-report.json') self.assertEqual( OwaspDepCheck('')._read_report(), json.loads(mock_owasp_dep_check_generated_repo)) os.remove('/tmp/dependency-check-report.json')
def run_tools(path_to_analyze): # -- Run all analysis retirejs_report = RetireJS(path=path_to_analyze).run_retirejs() owasp_depcheck_report = OwaspDepCheck(path=path_to_analyze).run_owasp_depcheck() # -- Generate full report and return full_report = json.dumps(_avoid_repetition(retirejs_report + owasp_depcheck_report)) return full_report
def test_get_type_unknown(self): self.assertEqual(OwaspDepCheck('')._get_type('dependency.exe', '/home/user/dependency.exe'), 'unknown')
def test_get_type_php(self): self.assertEqual(OwaspDepCheck('')._get_type('dependency.php', '/home/user/dependency.php'), 'php')
def test_get_type_ruby(self): self.assertEqual(OwaspDepCheck('')._get_type('dependency.rb', '/home/user/dependency.rb'), 'ruby')
def test_get_type_python(self): self.assertEqual(OwaspDepCheck('')._get_type('dependency.py', '/home/user/dependency.py'), 'python')
def test_get_type_js(self): self.assertEqual(OwaspDepCheck('')._get_type('dependency.js', '/home/user/dependency.js'), 'js')
def test_get_type_java(self): self.assertEqual(OwaspDepCheck('')._get_type('dependency.jar'), 'java')