mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 16:35:02 +01:00
Subject: utils tests: assign regex function at test setup
This patch moves the assignment of the regex function into the unittest setUp() function rather than at script load time. If for some reason the python utils library does not define the relevant function, without this patch the script fails entirely; with it, each individual test class that depends on the missing regex will fail each test case. Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
parent
6d34893d4d
commit
b86d83759a
1 changed files with 16 additions and 8 deletions
|
@ -184,7 +184,8 @@ def setup_regex_tests(test_class):
|
|||
class AARegexCapability(unittest.TestCase):
|
||||
'''Tests for RE_PROFILE_CAP'''
|
||||
|
||||
regex = aa.RE_PROFILE_CAP
|
||||
def setUp(self):
|
||||
self.regex = aa.RE_PROFILE_CAP
|
||||
|
||||
tests = [
|
||||
(' capability net_raw,', (None, None, 'net_raw', None)),
|
||||
|
@ -198,7 +199,8 @@ class AARegexCapability(unittest.TestCase):
|
|||
class AARegexPath(unittest.TestCase):
|
||||
'''Tests for RE_PROFILE_PATH_ENTRY'''
|
||||
|
||||
regex = aa.RE_PROFILE_PATH_ENTRY
|
||||
def setUp(self):
|
||||
self.regex = aa.RE_PROFILE_PATH_ENTRY
|
||||
|
||||
tests = [
|
||||
(' /tmp/foo r,',
|
||||
|
@ -216,7 +218,8 @@ class AARegexPath(unittest.TestCase):
|
|||
class AARegexBareFile(unittest.TestCase):
|
||||
'''Tests for RE_PROFILE_BARE_FILE_ENTRY'''
|
||||
|
||||
regex = aa.RE_PROFILE_BARE_FILE_ENTRY
|
||||
def setUp(self):
|
||||
self.regex = aa.RE_PROFILE_BARE_FILE_ENTRY
|
||||
|
||||
tests = [
|
||||
(' file,', (None, None, None, None)),
|
||||
|
@ -233,7 +236,8 @@ class AARegexBareFile(unittest.TestCase):
|
|||
class AARegexDbus(unittest.TestCase):
|
||||
'''Tests for RE_PROFILE_DBUS'''
|
||||
|
||||
regex = aa.RE_PROFILE_DBUS
|
||||
def setUp(self):
|
||||
self.regex = aa.RE_PROFILE_DBUS
|
||||
|
||||
tests = [
|
||||
(' dbus,', (None, None, 'dbus,', None)),
|
||||
|
@ -248,7 +252,8 @@ class AARegexDbus(unittest.TestCase):
|
|||
class AARegexMount(unittest.TestCase):
|
||||
'''Tests for RE_PROFILE_MOUNT'''
|
||||
|
||||
regex = aa.RE_PROFILE_MOUNT
|
||||
def setUp(self):
|
||||
self.regex = aa.RE_PROFILE_MOUNT
|
||||
|
||||
tests = [
|
||||
(' mount,', (None, None, 'mount,', 'mount', None, None)),
|
||||
|
@ -271,7 +276,8 @@ class AARegexMount(unittest.TestCase):
|
|||
class AARegexSignal(unittest.TestCase):
|
||||
'''Tests for RE_PROFILE_SIGNAL'''
|
||||
|
||||
regex = aa.RE_PROFILE_SIGNAL
|
||||
def setUp(self):
|
||||
self.regex = aa.RE_PROFILE_SIGNAL
|
||||
|
||||
tests = [
|
||||
(' signal,', (None, None, 'signal,', None)),
|
||||
|
@ -296,7 +302,8 @@ class AARegexSignal(unittest.TestCase):
|
|||
class AARegexPtrace(unittest.TestCase):
|
||||
'''Tests for RE_PROFILE_PTRACE'''
|
||||
|
||||
regex = aa.RE_PROFILE_PTRACE
|
||||
def setUp(self):
|
||||
self.regex = aa.RE_PROFILE_PTRACE
|
||||
|
||||
tests = [
|
||||
(' ptrace,', (None, None, 'ptrace,', None)),
|
||||
|
@ -317,7 +324,8 @@ class AARegexPtrace(unittest.TestCase):
|
|||
class AARegexPivotRoot(unittest.TestCase):
|
||||
'''Tests for RE_PROFILE_PIVOT_ROOT'''
|
||||
|
||||
regex = aa.RE_PROFILE_PIVOT_ROOT
|
||||
def setUp(self):
|
||||
self.regex = aa.RE_PROFILE_PIVOT_ROOT
|
||||
|
||||
tests = [
|
||||
(' pivot_root,', (None, None, 'pivot_root,', None)),
|
||||
|
|
Loading…
Add table
Reference in a new issue