From 0371b145679bf5fb18f8e9d8f8a4f2faed62ff52 Mon Sep 17 00:00:00 2001 From: Marius Gedminas <marius@gedmin.as> Date: Wed, 30 Sep 2015 09:16:45 +0300 Subject: [PATCH] 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.) --- test/units/module_utils/test_basic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/units/module_utils/test_basic.py b/test/units/module_utils/test_basic.py index 60decd8dac7..78116847de5 100644 --- a/test/units/module_utils/test_basic.py +++ b/test/units/module_utils/test_basic.py @@ -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')