2016-10-01 20:57:09 +02:00
|
|
|
#! /usr/bin/python3
|
2014-04-23 15:41:03 -05:00
|
|
|
# ------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# 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 unittest
|
2022-08-07 20:32:07 -04:00
|
|
|
|
|
|
|
import apparmor.aa as aa
|
|
|
|
from common_test import AAParseTest, setup_aa, setup_regex_tests
|
2014-04-23 15:41:03 -05:00
|
|
|
|
2022-08-07 12:26:24 -04:00
|
|
|
|
2014-09-03 18:31:09 -07:00
|
|
|
class AAParsePivotRootTest(AAParseTest):
|
|
|
|
def setUp(self):
|
|
|
|
self.parse_function = aa.parse_pivot_root_rule
|
2014-04-23 15:41:03 -05:00
|
|
|
|
2022-06-18 14:30:49 -04:00
|
|
|
tests = (
|
2022-08-07 12:26:24 -04:00
|
|
|
('pivot_root,', 'pivot_root base keyword'),
|
|
|
|
('pivot_root /old,', 'pivot_root oldroot rule'),
|
|
|
|
('pivot_root /old /new,', 'pivot_root old and new root rule'),
|
2014-09-03 18:31:09 -07:00
|
|
|
('pivot_root /old /new -> /usr/bin/child,', 'pivot_root child rule'),
|
2022-06-18 14:30:49 -04:00
|
|
|
)
|
2014-04-23 15:41:03 -05:00
|
|
|
|
2022-08-07 12:26:24 -04:00
|
|
|
|
2017-03-02 21:21:53 +00:00
|
|
|
setup_aa(aa)
|
2014-04-23 15:41:03 -05:00
|
|
|
if __name__ == '__main__':
|
2014-09-03 18:31:09 -07:00
|
|
|
setup_regex_tests(AAParsePivotRootTest)
|
2018-04-08 20:18:30 +02:00
|
|
|
unittest.main(verbosity=1)
|