[apparmor] [patch] various fixes for minitools_test.py
Kshitij Gupta
kgupta8592 at gmail.com
Sun Sep 14 14:28:32 UTC 2014
Hello,
On Sun, Sep 14, 2014 at 4:01 AM, Christian Boltz <apparmor at cboltz.de> wrote:
> Hello,
>
> this patch contains various fixes for utils/test/minitools_test.py:
> - test_audit: fix error message
> - test_complain: replace "aa-complain -r" with aa-enforce (we removed
> the -r flag from aa-complain)
> - test_complain: disable checks for force-complain symlinks,
> aa-complain doesn't create them
>
>
> === modified file 'utils/test/minitools_test.py'
> --- utils/test/minitools_test.py 2014-07-17 13:59:57 +0000
> +++ utils/test/minitools_test.py 2014-09-13 22:24:43 +0000
> @@ -41,18 +41,18 @@
> #Remove audit mode from ntpd profile and check if it was correctly removed
> subprocess.check_output('%s ./../aa-audit -d ./profiles -r %s'%(python_interpreter, test_path), shell=True)
>
> - self.assertEqual(apparmor.get_profile_flags(local_profilename, test_path), None, 'Complain flag could not be removed in profile %s'%local_profilename)
> + self.assertEqual(apparmor.get_profile_flags(local_profilename, test_path), None, 'Audit flag could not be removed in profile %s'%local_profilename)
>
>
> def test_complain(self):
> #Set ntpd profile to complain mode and check if it was correctly set
> subprocess.check_output('%s ./../aa-complain -d ./profiles %s'%(python_interpreter, test_path), shell=True)
>
> - self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), True, 'Failed to create a symlink for %s in force-complain'%local_profilename)
> +# self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), True, 'Failed to create a symlink for %s in force-complain'%local_profilename)
> self.assertEqual(apparmor.get_profile_flags(local_profilename, test_path), 'complain', 'Complain flag could not be set in profile %s'%local_profilename)
>
> #Set ntpd profile to enforce mode and check if it was correctly set
> - subprocess.check_output('%s ./../aa-complain -d ./profiles -r %s'%(python_interpreter, test_path), shell=True)
> + subprocess.check_output('%s ./../aa-enforce -d ./profiles %s'%(python_interpreter, test_path), shell=True)
>
> self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), False, 'Failed to remove symlink for %s from force-complain'%local_profilename)
> self.assertEqual(os.path.islink('./profiles/disable/%s'%os.path.basename(local_profilename)), False, 'Failed to remove symlink for %s from disable'%local_profilename)
> @@ -62,11 +62,11 @@
> subprocess.check_output('%s ./../aa-audit -d ./profiles %s'%(python_interpreter, test_path), shell=True)
> subprocess.check_output('%s ./../aa-complain -d ./profiles %s'%(python_interpreter, test_path), shell=True)
>
> - self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), True, 'Failed to create a symlink for %s in force-complain'%local_profilename)
> +# self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), True, 'Failed to create a symlink for %s in force-complain'%local_profilename)
> self.assertEqual(apparmor.get_profile_flags(local_profilename, test_path), 'audit,complain', 'Complain flag could not be set in profile %s'%local_profilename)
>
> #Remove complain flag first i.e. set to enforce mode
> - subprocess.check_output('%s ./../aa-complain -d ./profiles -r %s'%(python_interpreter, test_path), shell=True)
> + subprocess.check_output('%s ./../aa-enforce -d ./profiles %s'%(python_interpreter, test_path), shell=True)
>
> self.assertEqual(os.path.islink('./profiles/force-complain/%s'%os.path.basename(local_profilename)), False, 'Failed to remove symlink for %s from force-complain'%local_profilename)
> self.assertEqual(os.path.islink('./profiles/disable/%s'%os.path.basename(local_profilename)), False, 'Failed to remove symlink for %s from disable'%local_profilename)
>
>
Thanks for the patch.
Acked-by: Kshitij Gupta <kgupta8592 at gmail.com>.
Regards,
Kshitij Gupta
>
> Regards,
>
> Christian Boltz
> --
> "Theory and practice sometimes clash. And when that happens,
> theory loses. Every single time." -- Linus Torvalds
>
>
> --
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
More information about the AppArmor
mailing list