aboutsummaryrefslogtreecommitdiff
path: root/tests/test_distro.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-09-23 12:55:47 +0200
committerGuido Günther <agx@sigxcpu.org>2016-09-23 13:14:14 +0200
commit39f306f1783b47cae11c80ba31c86be677eff226 (patch)
tree53ac2c8f16d26144b98703d4e10032b45cca9d41 /tests/test_distro.py
parent04ec8384e2b7332c5f7d047ed28b91c9d15c7327 (diff)
Allow to filter service by regular expressions
Diffstat (limited to 'tests/test_distro.py')
-rw-r--r--tests/test_distro.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_distro.py b/tests/test_distro.py
index f061eab..21df2c0 100644
--- a/tests/test_distro.py
+++ b/tests/test_distro.py
@@ -54,3 +54,20 @@ class TestDistro(unittest.TestCase):
with patch('os.path.exists', return_value=False):
d = detect()
self.assertEqual(d.id, 'Debian')
+
+ def test_filter_services_empty(self):
+ d = Distro()
+ self.assertEqual(set(['foo', 'bar']),
+ d.filter_services(['foo', 'bar']))
+
+ def test_filter_services_one(self):
+ d = Distro()
+ d.service_blacklist_re = ['^f..']
+ self.assertEqual(set(['bar']),
+ d.filter_services(['foo', 'bar']))
+
+ def test_filter_services_all(self):
+ d = Distro()
+ d.service_blacklist_re = ['^f..', '^b..']
+ self.assertEqual(set(),
+ d.filter_services(['foo', 'bar']))