def _run_test(self, params, expected): obj = PtraceRule._parse(params) self.assertEqual(obj.logprof_header(), expected)
def test_empty_data_2(self): obj = PtraceRule('read', '/foo') obj.peer = '' # no ptrace set, and ALL not set with self.assertRaises(AppArmorBug): obj.get_clean(1)
def test_missing_params_2(self): with self.assertRaises(TypeError): PtraceRule('r')
def _run_test(self, params, expected): with self.assertRaises(expected): PtraceRule(params[0], params[1])
def _run_test(self, rawrule, expected): self.assertTrue(PtraceRule.match( rawrule)) # the above invalid rules still match the main regex! with self.assertRaises(expected): PtraceRule.parse(rawrule)
def _run_test(self, rawrule, expected): self.assertTrue(PtraceRule.match(rawrule)) obj = PtraceRule.parse(rawrule) self.assertEqual(rawrule.strip(), obj.raw_rule) self._compare_obj(obj, expected)