mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 22:05:27 +00:00
*TestParseInvalid: move tests not matching regex into tests array
This commit is contained in:
@@ -128,20 +128,16 @@ class MountTestParseInvalid(AATest):
|
||||
('priority=-1042 umount,', (AppArmorException, True)),
|
||||
('mount fstype=({unclosed_regex),', (AppArmorException, True)), # invalid AARE
|
||||
('mount fstype=({closed}twice}),', (AppArmorException, True)), # invalid AARE
|
||||
('foo,', (AppArmorException, False)),
|
||||
('priority=a mount,', (AppArmorException, False)),
|
||||
('priority=a umount,', (AppArmorException, False)),
|
||||
('priority=a unmount,', (AppArmorException, False)),
|
||||
('priority=a remount,', (AppArmorException, False)),
|
||||
)
|
||||
|
||||
def _run_test(self, rawrule, expected):
|
||||
self.parseInvalidRule(MountRule, rawrule, expected)
|
||||
|
||||
def test_parse_fail(self):
|
||||
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)
|
||||
|
Reference in New Issue
Block a user