mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
ProfileList: add get_all_profiles()
... and a test for it
This commit is contained in:
parent
c93d560f89
commit
531f47676d
2 changed files with 7 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue