mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 10:40:22 -07:00
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:
parent
f8fe1357b0
commit
28443cf0a9
1 changed files with 14 additions and 12 deletions
|
@ -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):
|
||||||
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):
|
||||||
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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue