2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 10:07:12 +00:00
apparmor/utils/test/test-pivot_root_parse.py
Steve Beattie ab2ac92ecf utils: make all tests consistent in verbosity
This patch adjusts the verbosity of several of the utils tests,
to make them all consistently verbose.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-07-25 17:49:06 -07:00

36 lines
1.2 KiB
Python

#! /usr/bin/env python
# ------------------------------------------------------------------
#
# Copyright (C) 2014 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Foundation.
#
# ------------------------------------------------------------------
import apparmor.aa as aa
import unittest
class AAParsePivotRootTest(unittest.TestCase):
def _test_parse_pivot_root_rule(self, rule):
pivot_root = aa.parse_pivot_root_rule(rule)
self.assertEqual(rule, pivot_root.serialize(),
'pivot_root object returned "%s", expected "%s"' % (pivot_root.serialize(), rule))
def test_parse_plain_pivot_root_rule(self):
self._test_parse_pivot_root_rule('pivot_root,')
def test_parse_old_pivot_root_rule(self):
self._test_parse_pivot_root_rule('pivot_root /old,')
def test_parse_new_pivot_root_rule(self):
self._test_parse_pivot_root_rule('pivot_root /old /new,')
def test_parse_child_pivot_root_rule(self):
self._test_parse_pivot_root_rule('pivot_root /old /new -> /usr/bin/child,')
if __name__ == '__main__':
unittest.main(verbosity=2)