Fix test: selinux gets passed byte strings

(I don't have a system with selinux to test if the module still wants
byte strings even on Python 3.)
This commit is contained in:
Marius Gedminas 2015-09-30 09:16:45 +03:00
parent 500e7a1263
commit 0371b14567

View file

@ -602,7 +602,7 @@ class TestModuleUtilsBasic(unittest.TestCase):
with patch.dict('sys.modules', {'selinux': basic.selinux}):
with patch('selinux.lsetfilecon', return_value=0) as m:
self.assertEqual(am.set_context_if_different('/path/to/file', ['foo_u', 'foo_r', 'foo_t', 's0'], False), True)
m.assert_called_with('/path/to/file', 'foo_u:foo_r:foo_t:s0')
m.assert_called_with(b'/path/to/file', 'foo_u:foo_r:foo_t:s0')
m.reset_mock()
am.check_mode = True
self.assertEqual(am.set_context_if_different('/path/to/file', ['foo_u', 'foo_r', 'foo_t', 's0'], False), True)
@ -619,7 +619,7 @@ class TestModuleUtilsBasic(unittest.TestCase):
with patch('selinux.lsetfilecon', return_value=0) as m:
self.assertEqual(am.set_context_if_different('/path/to/file', ['foo_u', 'foo_r', 'foo_t', 's0'], False), True)
m.assert_called_with('/path/to/file', 'sp_u:sp_r:sp_t:s0')
m.assert_called_with(b'/path/to/file', 'sp_u:sp_r:sp_t:s0')
delattr(basic, 'selinux')