mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #47667 from Ch3LL/mac_user_enable
Update test_mac_user_enable_auto_login to test both py2 and py3
This commit is contained in:
commit
16c2153385
1 changed files with 6 additions and 2 deletions
|
@ -16,6 +16,7 @@ from tests.support.helpers import destructiveTest, skip_if_not_root
|
|||
# Import Salt Libs
|
||||
import salt.utils
|
||||
from salt.exceptions import CommandExecutionError
|
||||
import salt.ext.six as six
|
||||
|
||||
# Import 3rd-party libs
|
||||
from salt.ext.six.moves import range # pylint: disable=import-error,redefined-builtin
|
||||
|
@ -173,8 +174,11 @@ class MacUserModuleTest(ModuleCase):
|
|||
self.assertTrue(os.path.exists('/etc/kcpassword'))
|
||||
|
||||
# Are the contents of the file correct
|
||||
test_data = b".\xc3\xb8'B\xc2\xa0\xc3\x99\xc2\xad\xc2\x8b\xc3\x8d\xc3\x8dl"
|
||||
with salt.utils.fopen('/etc/kcpassword', 'rb') as f:
|
||||
if six.PY2:
|
||||
test_data = b'.\xf8\'B\xa0\xd9\xad\x8b\xcd\xcdl'
|
||||
else:
|
||||
test_data = b".\xc3\xb8'B\xc2\xa0\xc3\x99\xc2\xad\xc2\x8b\xc3\x8d\xc3\x8dl"
|
||||
with salt.utils.fopen('/etc/kcpassword', 'r' if six.PY2 else 'rb') as f:
|
||||
file_data = f.read()
|
||||
self.assertEqual(test_data, file_data)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue