Skip to content

Commit 6679253

Browse files
committed
add fixture for the certificate config
1 parent 7af8bd1 commit 6679253

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
apypie>=0.5.0
2+
jinja2
23
paramiko
34
pytest-testinfra
45
pytest-durations
6+
pyyaml

tests/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
import paramiko
55
import pytest
66
import testinfra
7+
import yaml
8+
9+
from jinja2 import Environment, FileSystemLoader, select_autoescape
10+
11+
@pytest.fixture(scope="module")
12+
def certificates():
13+
env = Environment(loader=FileSystemLoader("."), autoescape=select_autoescape())
14+
template = env.get_template("./vars/default_certificates.yml")
15+
context = {'certificates_ca_directory': '/root/certificates',
16+
'ansible_fqdn': 'quadlet.example.com'}
17+
return yaml.safe_load(template.render(context))
718

819

920
@pytest.fixture(scope="module")

0 commit comments

Comments
 (0)