From 32b11c03758b1d0ff92fd2b5a347ec65b0f5821f Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Fri, 25 Dec 2020 18:48:27 +0100 Subject: [PATCH] Add missing test for ProfileList add_alias() ... to ensure that it errors out if a wrong parameter type is given. This also increases the test coverage of ProfileList to 100%. --- utils/test/test-profile-list.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/test/test-profile-list.py b/utils/test/test-profile-list.py index 41d101b42..559f8a7d5 100644 --- a/utils/test/test-profile-list.py +++ b/utils/test/test-profile-list.py @@ -235,6 +235,11 @@ class TestAdd_alias(AATest): self.pl.add_alias('/etc/apparmor.d/bin.foo', AliasRule('/foo', None)) # target None insteadd of str self.assertEqual(list(self.pl.files.keys()), []) + def testAdd_alias_error_3(self): + with self.assertRaises(AppArmorBug): + self.pl.add_alias('/etc/apparmor.d/bin.foo', 'alias /foo -> /bar,') # str insteadd of AliasRule + self.assertEqual(list(self.pl.files.keys()), []) + def test_dedup_alias_1(self): self.pl.add_alias('/etc/apparmor.d/bin.foo', AliasRule('/foo', '/bar')) self.pl.add_alias('/etc/apparmor.d/bin.foo', AliasRule('/foo', '/another_target'))