|
@@ -1,14 +1,6 @@
|
|
-# -*- coding: utf-8 -*-
|
|
|
|
-
|
|
|
|
-# Import python libs
|
|
|
|
-from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
-
|
|
|
|
from textwrap import dedent
|
|
from textwrap import dedent
|
|
|
|
|
|
-# Import 3rd party libs
|
|
|
|
import jinja2
|
|
import jinja2
|
|
-
|
|
|
|
-# Import salt libs
|
|
|
|
import salt.serializers.configparser as configparser
|
|
import salt.serializers.configparser as configparser
|
|
import salt.serializers.json as json
|
|
import salt.serializers.json as json
|
|
import salt.serializers.msgpack as msgpack
|
|
import salt.serializers.msgpack as msgpack
|
|
@@ -18,21 +10,16 @@ import salt.serializers.toml as toml
|
|
import salt.serializers.yaml as yaml
|
|
import salt.serializers.yaml as yaml
|
|
import salt.serializers.yamlex as yamlex
|
|
import salt.serializers.yamlex as yamlex
|
|
import yaml as _yaml # future lint: disable=blacklisted-import
|
|
import yaml as _yaml # future lint: disable=blacklisted-import
|
|
-from salt.ext import six
|
|
|
|
from salt.serializers import SerializationError
|
|
from salt.serializers import SerializationError
|
|
from salt.serializers.yaml import EncryptedString
|
|
from salt.serializers.yaml import EncryptedString
|
|
from salt.utils.odict import OrderedDict
|
|
from salt.utils.odict import OrderedDict
|
|
-
|
|
|
|
-# Import test support libs
|
|
|
|
from tests.support.helpers import flaky
|
|
from tests.support.helpers import flaky
|
|
-
|
|
|
|
-# Import Salt Testing libs
|
|
|
|
from tests.support.unit import TestCase, skipIf
|
|
from tests.support.unit import TestCase, skipIf
|
|
|
|
|
|
SKIP_MESSAGE = "%s is unavailable, have prerequisites been met?"
|
|
SKIP_MESSAGE = "%s is unavailable, have prerequisites been met?"
|
|
|
|
|
|
|
|
|
|
-@flaky(condition=six.PY3)
|
|
|
|
|
|
+@flaky(condition=True)
|
|
class TestSerializers(TestCase):
|
|
class TestSerializers(TestCase):
|
|
@skipIf(not json.available, SKIP_MESSAGE % "json")
|
|
@skipIf(not json.available, SKIP_MESSAGE % "json")
|
|
def test_serialize_json(self):
|
|
def test_serialize_json(self):
|
|
@@ -116,7 +103,7 @@ class TestSerializers(TestCase):
|
|
|
|
|
|
@skipIf(not yaml.available, SKIP_MESSAGE % "yaml")
|
|
@skipIf(not yaml.available, SKIP_MESSAGE % "yaml")
|
|
@skipIf(not yamlex.available, SKIP_MESSAGE % "sls")
|
|
@skipIf(not yamlex.available, SKIP_MESSAGE % "sls")
|
|
- @skipIf(six.PY3, "Flaky on Python 3.")
|
|
|
|
|
|
+ @skipIf(True, "Flaky on Python 3.")
|
|
def test_compare_sls_vs_yaml_with_jinja(self):
|
|
def test_compare_sls_vs_yaml_with_jinja(self):
|
|
tpl = "{{ data }}"
|
|
tpl = "{{ data }}"
|
|
env = jinja2.Environment()
|
|
env = jinja2.Environment()
|
|
@@ -374,14 +361,14 @@ class TestSerializers(TestCase):
|
|
data = {"foo": "bar"}
|
|
data = {"foo": "bar"}
|
|
serialized = plist.serialize(data)
|
|
serialized = plist.serialize(data)
|
|
expected = (
|
|
expected = (
|
|
- '<?xml version="1.0" encoding="UTF-8"?>\n'
|
|
|
|
- '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n'
|
|
|
|
- '<plist version="1.0">\n'
|
|
|
|
- "<dict>\n"
|
|
|
|
- "\t<key>foo</key>\n"
|
|
|
|
- "\t<string>bar</string>\n"
|
|
|
|
- "</dict>\n"
|
|
|
|
- "</plist>\n".encode("utf-8")
|
|
|
|
|
|
+ b'<?xml version="1.0" encoding="UTF-8"?>\n'
|
|
|
|
+ b'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n'
|
|
|
|
+ b'<plist version="1.0">\n'
|
|
|
|
+ b"<dict>\n"
|
|
|
|
+ b"\t<key>foo</key>\n"
|
|
|
|
+ b"\t<string>bar</string>\n"
|
|
|
|
+ b"</dict>\n"
|
|
|
|
+ b"</plist>\n"
|
|
)
|
|
)
|
|
assert serialized == expected, serialized
|
|
assert serialized == expected, serialized
|
|
|
|
|