mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 13:58:22 +00:00
ProfileList: add get_all_profiles()
... and a test for it
This commit is contained in:
parent
c93d560f89
commit
531f47676d
@ -189,6 +189,9 @@ class ProfileList:
|
|||||||
|
|
||||||
return deleted
|
return deleted
|
||||||
|
|
||||||
|
def get_all_profiles(self):
|
||||||
|
return self.profiles
|
||||||
|
|
||||||
def get_profile_and_childs(self, profile_name):
|
def get_profile_and_childs(self, profile_name):
|
||||||
found = {}
|
found = {}
|
||||||
for prof in self.profiles:
|
for prof in self.profiles:
|
||||||
|
@ -508,9 +508,12 @@ class TestGet_profile_and_childs(AATest):
|
|||||||
self.pl.add_profile('/etc/apparmor.d/bin.foo', 'foo//xy', '/bin/foo//xy', self.dummy_profile)
|
self.pl.add_profile('/etc/apparmor.d/bin.foo', 'foo//xy', '/bin/foo//xy', self.dummy_profile)
|
||||||
|
|
||||||
expected = ['foo', 'foo//bar', 'foo//xy']
|
expected = ['foo', 'foo//bar', 'foo//xy']
|
||||||
|
|
||||||
self.assertEqual(list(self.pl.get_profile_and_childs('foo')), expected)
|
self.assertEqual(list(self.pl.get_profile_and_childs('foo')), expected)
|
||||||
|
|
||||||
|
# while on it, also test get_all_profiles()
|
||||||
|
all_profiles = ['bafoo', 'foo', 'foobar', 'foo//bar', 'foo//xy']
|
||||||
|
self.assertEqual(list(self.pl.get_all_profiles()), all_profiles)
|
||||||
|
|
||||||
|
|
||||||
setup_aa(apparmor.aa)
|
setup_aa(apparmor.aa)
|
||||||
setup_all_loops(__name__)
|
setup_all_loops(__name__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user