def test_skips(self):
     # Check that all filters are skipped and that the last matches
     usercmd = ["cat", "/"]
     filtermatch = match_filter(self.filters, usercmd)
     self.assertTrue(filtermatch is self.filters[-1])
 def test_RegExpFilter_reject(self):
     usercmd = ["ls", "root"]
     filtermatch = match_filter(self.filters, usercmd)
     self.assertTrue(filtermatch is None)
 def test_missing_command(self):
     usercmd = ["foo_bar_not_exist"]
     filtermatch = match_filter(self.filters, usercmd)
     self.assertTrue(filtermatch is None)
 def test_RegExpFilter_match(self):
     usercmd = ["ls", "/root"]
     filtermatch = match_filter(self.filters, usercmd)
     self.assertFalse(filtermatch is None)
     self.assertEqual(filtermatch.get_command(usercmd), ["/bin/ls", "/root"])
Example #5
0
 def test_skips(self):
     # Check that all filters are skipped and that the last matches
     usercmd = ["cat", "/"]
     filtermatch = match_filter(self.filters, usercmd)
     self.assertTrue(filtermatch is self.filters[-1])
Example #6
0
 def test_missing_command(self):
     usercmd = ["foo_bar_not_exist"]
     filtermatch = match_filter(self.filters, usercmd)
     self.assertTrue(filtermatch is None)
Example #7
0
 def test_RegExpFilter_reject(self):
     usercmd = ["ls", "root"]
     filtermatch = match_filter(self.filters, usercmd)
     self.assertTrue(filtermatch is None)
Example #8
0
 def test_RegExpFilter_match(self):
     usercmd = ["ls", "/root"]
     filtermatch = match_filter(self.filters, usercmd)
     self.assertFalse(filtermatch is None)
     self.assertEqual(filtermatch.get_command(usercmd),
                      ["/bin/ls", "/root"])