Files
@ 7c07f17e46ba
Branch filter:
Location: majic-ansible-roles/roles/bootstrap/tests/test_parameters_mandatory.py - annotation
7c07f17e46ba
883 B
text/x-python
MAR-26: Implemented scaffolding for testing the ldap_server role:
- Fixed role documentation and example for the ldap_server ldap_entries
parameter.
- Fixed missing leading zero when setting mode for deployed files.
- Marked certain tasks for skipping Ansible linting on.
- Fixed invocation of local LDAP commands to use unix socket out of the
box (don't depend on LDAP client configuration).
- Default to state 'present' for ldap_entry (makes things a bit more
readable/clear).
- Added test data for backup and TLS.
- Added dummy default test file.
- Fixed role documentation and example for the ldap_server ldap_entries
parameter.
- Fixed missing leading zero when setting mode for deployed files.
- Marked certain tasks for skipping Ansible linting on.
- Fixed invocation of local LDAP commands to use unix socket out of the
box (don't depend on LDAP client configuration).
- Default to state 'present' for ldap_entry (makes things a bit more
readable/clear).
- Added test data for backup and TLS.
- Added dummy default test file.
0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca 0388df2571ca | import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
'.molecule/ansible_inventory').get_hosts('parameters-mandatory')
def test_authorized_keys(File, Sudo):
"""
Tests if Ansible user authorized_keys has been set-up correctly.
"""
with Sudo():
ssh_key = open(os.path.expanduser('~/.ssh/id_rsa.pub'), 'read').read().strip()
authorized_keys = File('/home/ansible/.ssh/authorized_keys')
assert authorized_keys.is_file
assert ssh_key in authorized_keys.content
def test_root_authorized_keys(File, Sudo):
"""
Tests if Ansible key been removed from root's authorized keys.
"""
with Sudo():
ssh_key = open(os.path.expanduser('~/.ssh/id_rsa.pub'), 'read').read().strip()
assert ssh_key not in File('/root/.ssh/authorized_keys').content
|