sepolgen: Close files after reading/writing in tests.

Signed-off-by: Robert Kuska <rkuska@redhat.com>
This commit is contained in:
Robert Kuska 2015-07-16 13:48:20 +02:00 committed by Stephen Smalley
parent 15a7553d22
commit a9fb9053f7
3 changed files with 3 additions and 0 deletions

View File

@ -166,6 +166,7 @@ class TestAuditParser(unittest.TestCase):
f = open("audit.txt")
a = sepolgen.audit.AuditParser()
a.parse_file(f)
f.close()
self.assertEqual(len(a.avc_msgs), 21)
self.assertEqual(len(a.compute_sid_msgs), 0)
self.assertEqual(len(a.invalid_msgs), 0)

View File

@ -268,6 +268,7 @@ class TestInterfaceSet(unittest.TestCase):
i2 = interfaces.InterfaceSet()
f = open("output")
i2.from_file(f)
f.close()
if_status = [False, False, False]
for ifv in i2.interfaces.values():
if ifv.name == "files_search_usr":

View File

@ -25,6 +25,7 @@ class TestInfoFlow(unittest.TestCase):
info = sepolgen.objectmodel.PermMappings()
fd = open("perm_map")
info.from_file(fd)
fd.close()
pm = info.get("filesystem", "mount")
self.assertEqual(pm.perm, "mount")