def setUp(self): super(RootwrapTestCase, self).setUp() self.filters = [ filters.RegExpFilter("/bin/ls", "root", 'ls', '/[a-z]+'), filters.CommandFilter("/usr/bin/foo_bar_not_exist", "root"), filters.RegExpFilter("/bin/cat", "root", 'cat', '/[a-z]+'), filters.CommandFilter("/nonexistent/cat", "root"), filters.CommandFilter("/bin/cat", "root") # Keep this one last ]
def test_empty_invalid_regexpfilter(self): f = filters.RegExpFilter("sleep", "root") self.assertFalse(f.match(["anything"])) self.assertFalse(f.match([]))
def test_empty_regexpfilter(self): f = filters.RegExpFilter("sleep", "root", "sleep") self.assertFalse(f.match([])) self.assertFalse(f.match(None))