Exemplo n.º 1
0
 def _run_test(self, params, expected):
     obj = PtraceRule._parse(params)
     self.assertEqual(obj.logprof_header(), expected)
Exemplo n.º 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)
Exemplo n.º 3
0
 def test_missing_params_2(self):
     with self.assertRaises(TypeError):
         PtraceRule('r')
Exemplo n.º 4
0
 def _run_test(self, params, expected):
     with self.assertRaises(expected):
         PtraceRule(params[0], params[1])
Exemplo n.º 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)
Exemplo n.º 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)