2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

add_or_remove_flag(): allow to add or remove multiple flags

Multiple flags can be given as string (will be split) or as array.

Also add some tests confirming that everything works as expected.
This commit is contained in:
Christian Boltz
2020-09-24 23:03:35 +02:00
parent 692f78cf3f
commit a2d3a382a8
2 changed files with 19 additions and 6 deletions

View File

@@ -50,6 +50,14 @@ class AaTest_add_or_remove_flag(AATest):
([ None, 'audit', False ], [] ),
([ 'complain', 'audit', True ], ['audit', 'complain'] ),
([ ' complain ', 'audit', False ], ['complain'] ),
([ 'audit complain', ['audit', 'complain'], False ], [] ),
([ 'audit complain', 'audit complain', False ], [] ),
([ 'audit complain', ['audit', 'enforce'], False ], ['complain'] ),
([ 'audit complain', 'audit enforce', False ], ['complain'] ),
([ '', ['audit', 'complain'], True ], ['audit', 'complain'] ),
([ '', 'audit complain', True ], ['audit', 'complain'] ),
([ 'audit', ['audit', 'enforce'], True ], ['audit', 'enforce'] ),
([ 'audit', 'audit enforce', True ], ['audit', 'enforce'] ),
]
def _run_test(self, params, expected):