[apparmor] [patch] Fix all tests in minitools_test.py

Kshitij Gupta kgupta8592 at gmail.com
Sun May 31 14:56:39 UTC 2015


Hello,

On Mon, May 25, 2015 at 9:12 PM, Christian Boltz <apparmor at cboltz.de> wrote:

> Hello,
>
> this patch changes minitools_test.py to use the winbind instead of the
> ntpd profile for testing. The tests broke because the ntpd profile has
> the attach_disconnected flag set now, and therefore didn't match the
> expected flags anymore.
>
> Relevant: Look for a nitpick in response of Patch34 for the test profile
change.

> Also replace the usage of filecmp.cmp() in the cleanprof test with
> reading the file and using assertEqual - this has the advantage that we
> get a full diff instead of just "files differ".
>
> I don't know how I feel about this as we libraries should be preferred but
sounds okay.


> Note: The aa-cleanprof test is still failing because of a bug in
> tools.py, but will be fixed by the next patch.
> See https://bugs.launchpad.net/apparmor/+bug/1416346 for details.
>
>
> [ 35-minitools_test-fix-all-tests.diff ]
>
> === modified file utils/test/minitools_test.py
> --- utils/test/minitools_test.py        2015-05-25 15:58:04.255541915 +0200
> +++ utils/test/minitools_test.py        2015-05-25 16:31:17.092437563 +0200
> @@ -17,14 +17,14 @@
>  import subprocess
>  import sys
>  import unittest
> -import filecmp
>
>  import apparmor.aa as apparmor
> +from common_test import read_file
>
>  # Path for the program
> -test_path = '/usr/sbin/ntpd'
> +test_path = '/usr/sbin/winbindd'
>  # Path for the target file containing profile
> -local_profilename = './profiles/usr.sbin.ntpd'
> +local_profilename = './profiles/usr.sbin.winbindd'
>
>  python_interpreter = 'python'
>  if sys.version_info >= (3, 0):
> @@ -118,7 +118,10 @@
>          #Strip off the first line (#modified line)
>          subprocess.check_output('sed -i 1d ./profiles/%s'%(input_file),
> shell=True)
>
> -        self.assertEqual(filecmp.cmp('./profiles/%s'%input_file,
> './%s'%output_file, False), True, 'Failed to cleanup profile properly')
> +        exp_content = read_file('./%s' % output_file)
> +        real_content = read_file('./profiles/%s' % input_file)
> +        self.maxDiff = None
> +        self.assertEqual(exp_content, real_content, 'Failed to cleanup
> profile properly')
>
>
>  def clean_profile_dir():
>
> Acked-by: Kshitij Gupta <kgupta8592 at gmail.com>.

Thanks.

Regards,

Kshitij Gupta

>
>
> Regards,
>
> Christian Boltz
> --
> Der von Ihnen vielleicht erwartete Input wird zu dem eines verstimmten
> Mitarbeiters oder eines Crackers der Monate Zeit hat, oder einer Katze,
> die über die Tastatur läuft in keinerlei Zusammenhang stehen.
> [http://php.net/manual/de/security.general.php]
>
>
> --
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/apparmor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20150531/f9bd9d19/attachment.html>


More information about the AppArmor mailing list