def _check_invalid_rawrule(self, rawrule):
        obj = None
        self.assertFalse(ChangeProfileRule.match(rawrule))
        with self.assertRaises(AppArmorException):
            obj = ChangeProfileRule(ChangeProfileRule.parse(rawrule))

        self.assertIsNone(obj, 'ChangeProfileRule handed back an object unexpectedly')
    def _check_invalid_rawrule(self, rawrule):
        obj = None
        self.assertFalse(ChangeProfileRule.match(rawrule))
        with self.assertRaises(AppArmorException):
            obj = ChangeProfileRule(ChangeProfileRule.parse(rawrule))

        self.assertIsNone(obj, 'ChangeProfileRule handed back an object unexpectedly')
    def _run_test(self, rawrule, expected):
        self.assertTrue(ChangeProfileRule.match(rawrule))
        obj = ChangeProfileRule.parse(rawrule)
        clean = obj.get_clean()
        raw = obj.get_raw()

        self.assertEqual(expected.strip(), clean, 'unexpected clean rule')
        self.assertEqual(rawrule.strip(), raw, 'unexpected raw rule')
    def _run_test(self, rawrule, expected):
        self.assertTrue(ChangeProfileRule.match(rawrule))
        obj = ChangeProfileRule.parse(rawrule)
        clean = obj.get_clean()
        raw = obj.get_raw()

        self.assertEqual(expected.strip(), clean, 'unexpected clean rule')
        self.assertEqual(rawrule.strip(), raw, 'unexpected raw rule')
    def _run_test(self, param, expected):
        obj = ChangeProfileRule.parse(self.rule)
        check_obj = ChangeProfileRule.parse(param)

        self.assertTrue(ChangeProfileRule.match(param))

        self.assertEqual(obj.is_equal(check_obj), expected[0], 'Mismatch in is_equal, expected %s' % expected[0])
        self.assertEqual(obj.is_equal(check_obj, True), expected[1], 'Mismatch in is_equal/strict, expected %s' % expected[1])

        self.assertEqual(obj.is_covered(check_obj), expected[2], 'Mismatch in is_covered, expected %s' % expected[2])
        self.assertEqual(obj.is_covered(check_obj, True, True), expected[3], 'Mismatch in is_covered/exact, expected %s' % expected[3])
    def _run_test(self, param, expected):
        obj = ChangeProfileRule.parse(self.rule)
        check_obj = ChangeProfileRule.parse(param)

        self.assertTrue(ChangeProfileRule.match(param))

        self.assertEqual(obj.is_equal(check_obj), expected[0], 'Mismatch in is_equal, expected %s' % expected[0])
        self.assertEqual(obj.is_equal(check_obj, True), expected[1], 'Mismatch in is_equal/strict, expected %s' % expected[1])

        self.assertEqual(obj.is_covered(check_obj), expected[2], 'Mismatch in is_covered, expected %s' % expected[2])
        self.assertEqual(obj.is_covered(check_obj, True, True), expected[3], 'Mismatch in is_covered/exact, expected %s' % expected[3])
 def _run_test(self, rawrule, expected):
     self.assertFalse(ChangeProfileRule.match(rawrule))
     with self.assertRaises(expected):
         ChangeProfileRule.parse(rawrule)
 def _run_test(self, rawrule, expected):
     self.assertTrue(ChangeProfileRule.match(rawrule))
     obj = ChangeProfileRule.parse(rawrule)
     self.assertEqual(rawrule.strip(), obj.raw_rule)
     self._compare_obj(obj, expected)
 def _run_test(self, rawrule, expected):
     self.assertFalse(ChangeProfileRule.match(rawrule))
     with self.assertRaises(expected):
         ChangeProfileRule.parse(rawrule)
 def _run_test(self, rawrule, expected):
     self.assertTrue(ChangeProfileRule.match(rawrule))
     obj = ChangeProfileRule.parse(rawrule)
     self.assertEqual(rawrule.strip(), obj.raw_rule)
     self._compare_obj(obj, expected)