first add
This commit is contained in:
30
tests/test_policies.py
Normal file
30
tests/test_policies.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import unittest
|
||||
|
||||
from fgai.policies import audit_policies, parse_policy_config
|
||||
|
||||
|
||||
class PolicyTests(unittest.TestCase):
|
||||
def test_policy_audit_finds_broad_unprotected_allow(self):
|
||||
policies = parse_policy_config(
|
||||
"""
|
||||
config firewall policy
|
||||
edit 1
|
||||
set srcaddr "all"
|
||||
set dstaddr "all"
|
||||
set service "ALL"
|
||||
set action accept
|
||||
set logtraffic disable
|
||||
next
|
||||
end
|
||||
"""
|
||||
)
|
||||
|
||||
findings = audit_policies(policies)
|
||||
|
||||
titles = {finding.title for finding in findings}
|
||||
self.assertIn("Broad allow policy", titles)
|
||||
self.assertIn("Accepted traffic lacks UTM inspection", titles)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user