mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
798 B
Python
23 lines
798 B
Python
6 years ago
|
# Copyright 2018, Matt Martz <matt@sivel.net>
|
||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||
|
|
||
|
from __future__ import absolute_import, division, print_function
|
||
|
__metaclass__ = type
|
||
|
|
||
|
import os
|
||
|
import json
|
||
|
|
||
|
import pytest
|
||
|
|
||
|
from ansible.parsing.ajson import AnsibleJSONDecoder
|
||
|
from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnicode
|
||
|
|
||
|
|
||
|
def test_AnsibleJSONDecoder_vault():
|
||
|
with open(os.path.join(os.path.dirname(__file__), 'fixtures/ajson.json')) as f:
|
||
|
data = json.load(f, cls=AnsibleJSONDecoder)
|
||
|
|
||
|
assert isinstance(data['password'], AnsibleVaultEncryptedUnicode)
|
||
|
assert isinstance(data['bar']['baz'][0]['password'], AnsibleVaultEncryptedUnicode)
|
||
|
assert isinstance(data['foo']['password'], AnsibleVaultEncryptedUnicode)
|