Пример #1
0
 def _run_test(self, params, expected):
     obj = PtraceRule._parse(params)
     self.assertEqual(obj.logprof_header(), expected)
Пример #2
0
 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)
Пример #3
0
 def test_missing_params_2(self):
     with self.assertRaises(TypeError):
         PtraceRule('r')
Пример #4
0
 def _run_test(self, params, expected):
     with self.assertRaises(expected):
         PtraceRule(params[0], params[1])
Пример #5
0
 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)
Пример #6
0
 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)