mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
c27bb7c116
This adds a unicode_literals import to the fileserver code, and also ensures that we return unicode paths from the serialized file/env list caches (which when deserialized are still encoded str types on PY2). It also adds a test and modifies a few other existing tests to confirm that unicode paths/envs are returned *as unicode* in the return data.
31 lines
833 B
Python
31 lines
833 B
Python
# -*- coding: utf-8 -*-
|
|
'''
|
|
:codeauthor: :email:`Joao Mesquita <jmesquita@sangoma.com>`
|
|
'''
|
|
|
|
# Import Python libs
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
# Import Salt Testing libs
|
|
from tests.support.unit import TestCase
|
|
|
|
from salt import fileserver
|
|
|
|
|
|
class MapDiffTestCase(TestCase):
|
|
def test_diff_with_diffent_keys(self):
|
|
'''
|
|
Test that different maps are indeed reported different
|
|
'''
|
|
map1 = {'file1': 1234}
|
|
map2 = {'file2': 1234}
|
|
assert fileserver.diff_mtime_map(map1, map2) is True
|
|
|
|
def test_diff_with_diffent_values(self):
|
|
'''
|
|
Test that different maps are indeed reported different
|
|
'''
|
|
map1 = {'file1': 12345}
|
|
map2 = {'file1': 1234}
|
|
assert fileserver.diff_mtime_map(map1, map2) is True
|