mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add regression test
This commit is contained in:
parent
ce782ff27a
commit
a36b15e449
1 changed files with 24 additions and 0 deletions
|
@ -264,3 +264,27 @@ class SREQTestCase(TestCase):
|
|||
# ensure no exceptions when we go to destroy the sreq, since __del__
|
||||
# swallows exceptions, we have to call destroy directly
|
||||
sreq.destroy()
|
||||
|
||||
def test_raw_vs_encoding_none(self):
|
||||
'''
|
||||
Test that we handle the new raw parameter in 5.0.2 correctly based on
|
||||
encoding. When encoding is None loads should return bytes
|
||||
'''
|
||||
payload = salt.payload.Serial('msgpack')
|
||||
dtvalue = datetime.datetime(2001, 2, 3, 4, 5, 6, 7)
|
||||
idata = {dtvalue: 'strval'}
|
||||
sdata = payload.dumps(idata.copy())
|
||||
odata = payload.loads(sdata, encoding=None)
|
||||
assert isinstance(odata[dtvalue], six.binary_type)
|
||||
|
||||
def test_raw_vs_encoding_utf8(self):
|
||||
'''
|
||||
Test that we handle the new raw parameter in 5.0.2 correctly based on
|
||||
encoding. When encoding is utf-8 loads should return unicode
|
||||
'''
|
||||
payload = salt.payload.Serial('msgpack')
|
||||
dtvalue = datetime.datetime(2001, 2, 3, 4, 5, 6, 7)
|
||||
idata = {dtvalue: 'strval'}
|
||||
sdata = payload.dumps(idata.copy())
|
||||
odata = payload.loads(sdata, encoding='utf-8')
|
||||
assert isinstance(odata[dtvalue], six.text_type)
|
||||
|
|
Loading…
Add table
Reference in a new issue