Updated parsing/vault/test_vault.py to use the fake byte literals in six when using hexlify.

This was to fix the `TypeError: 'str' does not support the buffer interface` errors.
This commit is contained in:
Rory Finnegan 2015-04-15 00:34:30 -04:00
parent f8fe1357b0
commit 28443cf0a9

View file

@ -24,6 +24,8 @@ import os
import shutil
import time
import tempfile
import six
from binascii import unhexlify
from binascii import hexlify
from nose.plugins.skip import SkipTest
@ -69,7 +71,7 @@ class TestVaultLib(unittest.TestCase):
def test_is_encrypted(self):
v = VaultLib(None)
assert not v.is_encrypted("foobar"), "encryption check on plaintext failed"
data = "$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify("ansible")
data = "$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify(six.b("ansible"))
assert v.is_encrypted(data), "encryption check on headered text failed"
def test_add_header(self):
@ -121,7 +123,7 @@ class TestVaultLib(unittest.TestCase):
raise SkipTest
v = VaultLib('ansible')
v.cipher_name = 'AES'
data = "$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify("ansible")
data = "$ANSIBLE_VAULT;9.9;TEST\n%s" % hexlify(six.b("ansible"))
error_hit = False
try:
enc_data = v.encrypt(data)