mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-04-08 03:33:25 +00:00
Revert "Fix documentation. (#751)" Revert "ACME modules: simplify code, refactor argspec handling code, move csr/csr_content to own docs fragment (#750)" Revert "Refactor and extend argument spec helper, use for ACME modules (#749)" Revert "Avoid exception if certificate has no AKI in acme_certificate. (#748)" Revert "ACME: improve acme_certificate docs, include cert_id in acme_certificate_renewal_info return value (#747)" Revert "Add acme_certificate_renewal_info module (#746)" Revert "Refactor time code, add tests, fix bug when parsing absolute timestamps that omit seconds (#745)" Revert "Add tests for acme_certificate_deactivate_authz module. (#744)" Revert "Create acme_certificate_deactivate_authz module (#741)" Revert "acme_certificate: allow to request renewal of a certificate according to ARI (#739)" Revert "Implement basic acme_ari_info module. (#732)" Revert "Add function for retrieval of ARI information. (#738)" Revert "acme module utils: add functions for parsing Retry-After header values and computation of ARI certificate IDs (#737)" Revert "Implement certificate information retrieval code in the ACME backends. (#736)" Revert "Split up the default acme docs fragment to allow modules ot not need account data. (#735)" This reverts commits5e59c5261e,aa82575a78,f3c9cb7a8a,f82b335916,553ab45f46,59606d48ad,0a15be1017,9501a28a93,d906914737,33d278ad8f,6d4fc589ae,9614b09f7a,af5f4b57f8,c6fbe58382, andafe7f7522c.
40 lines
895 B
Python
40 lines
895 B
Python
# Copyright (c) Ansible Project
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
__metaclass__ = type
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
from ansible_collections.community.crypto.plugins.module_utils.acme.utils import (
|
|
nopad_b64,
|
|
pem_to_der,
|
|
)
|
|
|
|
from .backend_data import (
|
|
TEST_PEM_DERS,
|
|
)
|
|
|
|
|
|
NOPAD_B64 = [
|
|
("", ""),
|
|
("\n", "Cg"),
|
|
("123", "MTIz"),
|
|
("Lorem?ipsum", "TG9yZW0_aXBzdW0"),
|
|
]
|
|
|
|
|
|
@pytest.mark.parametrize("value, result", NOPAD_B64)
|
|
def test_nopad_b64(value, result):
|
|
assert nopad_b64(value.encode('utf-8')) == result
|
|
|
|
|
|
@pytest.mark.parametrize("pem, der", TEST_PEM_DERS)
|
|
def test_pem_to_der(pem, der, tmpdir):
|
|
fn = tmpdir / 'test.pem'
|
|
fn.write(pem)
|
|
assert pem_to_der(str(fn)) == der
|