mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-06 01:05:11 +00:00
Write test for aa_gettaskcon SWIG wrapper
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
(cherry picked from commit 53e3116350
)
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
@@ -116,6 +116,16 @@ class AAPythonBindingsTests(unittest.TestCase):
|
||||
# extern int aa_getprocattr(pid_t tid, const char *attr, char **label, char **mode);
|
||||
# extern int aa_gettaskcon(pid_t target, char **label, char **mode);
|
||||
|
||||
@unittest.skipUnless(libapparmor.aa_is_enabled(), "AppArmor is not enabled")
|
||||
def test_aa_gettaskcon(self):
|
||||
# Our test harness should be running us as unconfined
|
||||
# Get our own pid and this should be equivalent to aa_getcon
|
||||
pid = os.getpid()
|
||||
|
||||
label, mode = libapparmor.aa_gettaskcon(pid)
|
||||
self.assertEqual(label, "unconfined", "aa_gettaskcon label should be unconfined")
|
||||
self.assertIsNone(mode, "aa_gettaskcon mode should be unconfined")
|
||||
|
||||
@unittest.skipUnless(libapparmor.aa_is_enabled(), "AppArmor is not enabled")
|
||||
def test_aa_getcon(self):
|
||||
# Our test harness should be running us as unconfined
|
||||
|
Reference in New Issue
Block a user