2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 13:58:22 +00:00

Merge add re_match_include_parse() test with invalid rule name

... to increase test coverity of regex.py to 100%.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/695
Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen
2021-01-10 11:38:57 +00:00

View File

@@ -594,14 +594,15 @@ class Test_re_match_include_parse_abi(AATest):
def _run_test(self, params, expected): def _run_test(self, params, expected):
self.assertEqual(re_match_include_parse(params, 'abi'), expected) self.assertEqual(re_match_include_parse(params, 'abi'), expected)
class Test_re_match_include_parse_empty_filename(AATest): class Test_re_match_include_parse_errors(AATest):
tests = [ tests = [
(('include <>', 'include'), AppArmorException), (('include <>', 'include'), AppArmorException), # various rules with empty filename
(('include ""', 'include'), AppArmorException), (('include ""', 'include'), AppArmorException),
(('include ', 'include'), AppArmorException), (('include ', 'include'), AppArmorException),
(('abi <>,', 'abi'), AppArmorException), (('abi <>,', 'abi'), AppArmorException),
(('abi "",', 'abi'), AppArmorException), (('abi "",', 'abi'), AppArmorException),
(('abi ,', 'abi'), AppArmorException), (('abi ,', 'abi'), AppArmorException),
(('abi <foo>,', 'invalid'), AppArmorBug), # invalid rule name
] ]
def _run_test(self, params, expected): def _run_test(self, params, expected):