2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-05 08:45:22 +00:00

extend add_or_remove_flag() to handle str for old flags

If the old flags are given as str (or None), call split_flags() to
convert them to a list.

This allows to simplify change_profile_flags() which now doesn't need to
call split_flags() on its own.

Also add some tests with a str for the old flags
This commit is contained in:
Christian Boltz
2018-07-25 20:59:34 +02:00
parent 604004c2b6
commit e80caa130a
3 changed files with 10 additions and 5 deletions

View File

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