Merge "Update tests dir to use yaml.safe_load()"
This commit is contained in:
commit
7d4e38dde1
@ -31,7 +31,7 @@ import pegleg
|
||||
from pegleg.engine.util.pegleg_secret_management import ENV_PASSPHRASE
|
||||
from pegleg.engine.util.pegleg_secret_management import ENV_SALT
|
||||
|
||||
TEST_PASSPHRASES_CATALOG = yaml.load("""
|
||||
TEST_PASSPHRASES_CATALOG = yaml.safe_load("""
|
||||
---
|
||||
schema: pegleg/PassphraseCatalog/v1
|
||||
metadata:
|
||||
@ -69,7 +69,7 @@ data:
|
||||
...
|
||||
""")
|
||||
|
||||
TEST_GLOBAL_PASSPHRASES_CATALOG = yaml.load("""
|
||||
TEST_GLOBAL_PASSPHRASES_CATALOG = yaml.safe_load("""
|
||||
---
|
||||
schema: pegleg/PassphraseCatalog/v1
|
||||
metadata:
|
||||
@ -87,7 +87,7 @@ data:
|
||||
...
|
||||
""")
|
||||
|
||||
TEST_BASE64_PASSPHRASES_CATALOG = yaml.load("""
|
||||
TEST_BASE64_PASSPHRASES_CATALOG = yaml.safe_load("""
|
||||
---
|
||||
schema: pegleg/PassphraseCatalog/v1
|
||||
metadata:
|
||||
@ -180,7 +180,7 @@ def test_generate_passphrases(*_):
|
||||
passphrase_file_name)
|
||||
assert os.path.isfile(passphrase_file_path)
|
||||
with open(passphrase_file_path) as stream:
|
||||
doc = yaml.load(stream)
|
||||
doc = yaml.safe_load(stream)
|
||||
assert doc['schema'] == 'pegleg/PeglegManagedDocument/v1'
|
||||
assert doc['metadata']['storagePolicy'] == 'cleartext'
|
||||
assert 'encrypted' in doc['data']
|
||||
|
@ -116,7 +116,7 @@ data: {0}-password
|
||||
encrypted_path = str(save_location.join("site/cicd/secrets/passphrases/"
|
||||
"cicd-passphrase-encrypted.yaml"))
|
||||
decrypted = secrets.decrypt(encrypted_path)
|
||||
assert yaml.load(decrypted[encrypted_path]) == yaml.load(passphrase_doc)
|
||||
assert yaml.safe_load(decrypted[encrypted_path]) == yaml.safe_load(passphrase_doc)
|
||||
|
||||
|
||||
def test_pegleg_secret_management_constructor():
|
||||
|
@ -43,7 +43,7 @@ def _gen_document(**kwargs):
|
||||
if "storagePolicy" not in kwargs:
|
||||
kwargs["storagePolicy"] = "cleartext"
|
||||
test_document = TEST_DOCUMENT % kwargs
|
||||
return yaml.load(test_document)
|
||||
return yaml.safe_load(test_document)
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
@ -553,7 +553,7 @@ class TestSiteSecretsActions(BaseCLIActionTest):
|
||||
file_path = os.path.join(repo_path, "site", "airship-seaworthy",
|
||||
"secrets", "passphrases", "ceph_fsid.yaml")
|
||||
with open(file_path, "r") as ceph_fsid_fi:
|
||||
ceph_fsid = yaml.load(ceph_fsid_fi)
|
||||
ceph_fsid = yaml.safe_load(ceph_fsid_fi)
|
||||
ceph_fsid["metadata"]["storagePolicy"] = "encrypted"
|
||||
|
||||
with open(file_path, "w") as ceph_fsid_fi:
|
||||
@ -568,7 +568,7 @@ class TestSiteSecretsActions(BaseCLIActionTest):
|
||||
"secrets", "passphrases", "ceph_fsid.yaml"),
|
||||
"r") \
|
||||
as ceph_fsid_fi:
|
||||
ceph_fsid = yaml.load(ceph_fsid_fi)
|
||||
ceph_fsid = yaml.safe_load(ceph_fsid_fi)
|
||||
assert "encrypted" in ceph_fsid["data"]
|
||||
assert "managedDocument" in ceph_fsid["data"]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user