2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00:00

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
(cherry picked from commit c3d3203a60)
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
Christian Boltz
2020-12-25 19:57:20 +01:00
committed by John Johansen
parent c848e8e270
commit e35e838034

View File

@@ -594,14 +594,15 @@ class Test_re_match_include_parse_abi(AATest):
def _run_test(self, params, 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 = [
(('include <>', 'include'), AppArmorException),
(('include <>', 'include'), AppArmorException), # various rules with empty filename
(('include ""', 'include'), AppArmorException),
(('include ', 'include'), AppArmorException),
(('abi <>,', 'abi'), AppArmorException),
(('abi "",', 'abi'), AppArmorException),
(('abi ,', 'abi'), AppArmorException),
(('abi <foo>,', 'invalid'), AppArmorBug), # invalid rule name
]
def _run_test(self, params, expected):