예제 #1
0
 def test_skips(self):
     # Check that all filters are skipped and that the last matches
     usercmd = ["cat", "/"]
     filtermatch = wrapper.match_filter(self.filters, usercmd)
     self.assertTrue(filtermatch is self.filters[-1])
예제 #2
0
 def test_RegExpFilter_match(self):
     usercmd = ["ls", "/root"]
     filtermatch = wrapper.match_filter(self.filters, usercmd)
     self.assertFalse(filtermatch is None)
     self.assertEqual(filtermatch.get_command(usercmd),
                      ["/bin/ls", "/root"])
예제 #3
0
    def test_match_filter_recurses_exec_command_filter_matches(self):
        filter_list = [filters.IpNetnsExecFilter('/sbin/ip', 'root'),
                       filters.IpFilter('/sbin/ip', 'root')]
        args = ['ip', 'netns', 'exec', 'foo', 'ip', 'link', 'list']

        self.assertIsNotNone(wrapper.match_filter(filter_list, args))