mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 06:16:03 +00:00
utils: move tests for invalid priority to test-*
... instead of having them in test-modifiers.py for all rule types Also add a few additional tests while on it.
This commit is contained in:
@@ -124,6 +124,7 @@ class MountTestParseInvalid(AATest):
|
||||
('mount options=(),', AppArmorException),
|
||||
('mount option=(invalid),', AppArmorException),
|
||||
('mount option=(ext3ext4),', AppArmorException),
|
||||
('priority=-1042 umount,', AppArmorException),
|
||||
('mount fstype=({unclosed_regex),', AppArmorException), # invalid AARE
|
||||
('mount fstype=({closed}twice}),', AppArmorException), # invalid AARE
|
||||
)
|
||||
@@ -137,6 +138,19 @@ class MountTestParseInvalid(AATest):
|
||||
with self.assertRaises(AppArmorException):
|
||||
MountRule.create_instance('foo,')
|
||||
|
||||
def test_invalid_priority(self):
|
||||
for keyword in ['mount', 'umount', 'unmount', 'remount']:
|
||||
with self.assertRaises(AppArmorException):
|
||||
MountRule.create_instance('priority=a %s,' % keyword)
|
||||
|
||||
def test_invalid_priority_1(self):
|
||||
with self.assertRaises(TypeError):
|
||||
MountRule('mount', MountRule.ALL, MountRule.ALL, MountRule.ALL, MountRule.ALL, priority=MountRule.ALL)
|
||||
|
||||
def test_invalid_priority_2(self):
|
||||
with self.assertRaises(AppArmorException):
|
||||
MountRule('mount', MountRule.ALL, MountRule.ALL, MountRule.ALL, MountRule.ALL, priority='invalid')
|
||||
|
||||
def test_diff_non_mountrule(self):
|
||||
exp = namedtuple('exp', ('audit', 'deny', 'priority'))
|
||||
obj = MountRule('mount', ('=', ['ext4']), MountRule.ALL, MountRule.ALL, MountRule.ALL)
|
||||
|
Reference in New Issue
Block a user