Commit 28443cf0 by Rory Finnegan

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.
parent f8fe1357
...@@ -24,6 +24,8 @@ import os ...@@ -24,6 +24,8 @@ import os
import shutil import shutil
import time import time
import tempfile import tempfile
import six
from binascii import unhexlify from binascii import unhexlify
from binascii import hexlify from binascii import hexlify
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
...@@ -69,7 +71,7 @@ class TestVaultLib(unittest.TestCase): ...@@ -69,7 +71,7 @@ class TestVaultLib(unittest.TestCase):
def test_is_encrypted(self): def test_is_encrypted(self):
v = VaultLib(None) v = VaultLib(None)
assert not v.is_encrypted("foobar"), "encryption check on plaintext failed" 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" assert v.is_encrypted(data), "encryption check on headered text failed"
def test_add_header(self): def test_add_header(self):
...@@ -121,7 +123,7 @@ class TestVaultLib(unittest.TestCase): ...@@ -121,7 +123,7 @@ class TestVaultLib(unittest.TestCase):
raise SkipTest raise SkipTest
v = VaultLib('ansible') v = VaultLib('ansible')
v.cipher_name = 'AES' 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 error_hit = False
try: try:
enc_data = v.encrypt(data) enc_data = v.encrypt(data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment