aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/policy_tests.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/policy_tests.py b/tests/policy_tests.py
index 4b248b70..6d0c42b9 100644
--- a/tests/policy_tests.py
+++ b/tests/policy_tests.py
@@ -8,6 +8,7 @@
import unittest
from sos.policies import Policy, import_policy
+from sos.policies.distros import LinuxPolicy
from sos.policies.package_managers import PackageManager
from sos.report.plugins import (Plugin, IndependentPlugin,
RedHatPlugin, DebianPlugin)
@@ -17,6 +18,14 @@ class FauxPolicy(Policy):
distro = "Faux"
+class FauxLinuxPolicy(LinuxPolicy):
+ distro = "FauxLinux"
+
+ @classmethod
+ def set_forbidden_paths(cls):
+ return ['/etc/secret']
+
+
class FauxPlugin(Plugin, IndependentPlugin):
pass
@@ -31,12 +40,19 @@ class FauxDebianPlugin(Plugin, DebianPlugin):
class PolicyTests(unittest.TestCase):
+
def test_independent_only(self):
p = FauxPolicy()
p.valid_subclasses = []
self.assertTrue(p.validate_plugin(FauxPlugin))
+ def test_forbidden_paths_building(self):
+ p = FauxLinuxPolicy(probe_runtime=False)
+ self.assertTrue('*.pyc' in p.forbidden_paths)
+ self.assertTrue('/etc/passwd' in p.forbidden_paths)
+ self.assertTrue('/etc/secret' in p.forbidden_paths)
+
def test_redhat(self):
p = FauxPolicy()
p.valid_subclasses = [RedHatPlugin]