def test_ReadFileFilter(self): goodfn = '/good/file.name' f = filters.ReadFileFilter(goodfn) usercmd = ['cat', '/bad/file'] self.assertFalse(f.match(['cat', '/bad/file'])) usercmd = ['cat', goodfn] self.assertEqual(['/bin/cat', goodfn], f.get_command(usercmd)) self.assertTrue(f.match(usercmd))
def test_ReadFileFilter_empty_args(self): goodfn = '/good/file.name' f = filters.ReadFileFilter(goodfn) self.assertFalse(f.match([])) self.assertFalse(f.match(None))