Skip to content

Commit

Permalink
Add test for issue 64232
Browse files Browse the repository at this point in the history
  • Loading branch information
lkubb authored and Megan Wilhite committed May 10, 2023
1 parent d629d47 commit 816fdb8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/pytests/integration/modules/test_x509_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,35 @@ def test_sign_remote_certificate_copypath(x509_salt_call_cli, cert_args, tmp_pat
assert (tmp_path / f"{cert.serial_number:x}.crt").exists()


def test_create_private_key(x509_salt_call_cli):
"""
Ensure calling from the CLI works as expected and does not complain
about unknown internal kwargs (__pub_fun etc).
"""
ret = x509_salt_call_cli.run("x509.create_private_key")
assert ret.returncode == 0
assert ret.data
assert ret.data.startswith("-----BEGIN PRIVATE KEY-----")


def test_create_crl(x509_salt_call_cli, ca_key, ca_cert, x509_pkidir):
"""
Ensure calling from the CLI works as expected and does not complain
about unknown internal kwargs (__pub_fun etc).
"""
with pytest.helpers.temp_file("key", ca_key, x509_pkidir) as ca_keyfile:
with pytest.helpers.temp_file("cert", ca_cert, x509_pkidir) as ca_certfile:
ret = x509_salt_call_cli.run(
"x509.create_crl",
revoked=[],
signing_private_key=str(ca_keyfile),
signing_cert=str(ca_certfile),
)
assert ret.returncode == 0
assert ret.data
assert ret.data.startswith("-----BEGIN X509 CRL-----")


def _belongs_to(cert_or_pubkey, privkey):
if isinstance(cert_or_pubkey, cx509.Certificate):
cert_or_pubkey = cert_or_pubkey.public_key()
Expand Down

0 comments on commit 816fdb8

Please sign in to comment.