[apparmor] [patch] Fix all tests in minitools_test.py
Christian Boltz
apparmor at cboltz.de
Mon May 25 15:42:33 UTC 2015
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.
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".
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():
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]
More information about the AppArmor
mailing list