mirror of
https://github.com/KevinMidboe/playbooks-retailor.git
synced 2026-02-15 13:59:39 +00:00
ansible playbooks for retailor.io infrastructure
This commit is contained in:
23
roles/oh-my-zsh/molecule/default/tests/conftest.py
Normal file
23
roles/oh-my-zsh/molecule/default/tests/conftest.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""PyTest Fixtures."""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def pytest_runtest_setup(item):
|
||||
"""Run tests only when under molecule with testinfra installed."""
|
||||
try:
|
||||
import testinfra
|
||||
except ImportError:
|
||||
pytest.skip("Test requires testinfra", allow_module_level=True)
|
||||
if "MOLECULE_INVENTORY_FILE" in os.environ:
|
||||
pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||
os.environ["MOLECULE_INVENTORY_FILE"]
|
||||
).get_hosts("all")
|
||||
else:
|
||||
pytest.skip(
|
||||
"Test should run only from inside molecule.",
|
||||
allow_module_level=True
|
||||
)
|
||||
16
roles/oh-my-zsh/molecule/default/tests/console-setup.sh
Normal file
16
roles/oh-my-zsh/molecule/default/tests/console-setup.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
# CONFIGURATION FILE FOR SETUPCON
|
||||
|
||||
# Consult the console-setup(5) manual page.
|
||||
|
||||
ACTIVE_CONSOLES="/dev/tty[1-6]"
|
||||
|
||||
CHARMAP="ISO-8859-1"
|
||||
|
||||
CODESET="Lat15"
|
||||
FONTFACE="VGA"
|
||||
FONTSIZE="8x16"
|
||||
|
||||
VIDEOMODE=
|
||||
|
||||
# The following is an example how to use a braille font
|
||||
# FONT='lat9w-08.psf.gz brl-8x8.psf'
|
||||
50
roles/oh-my-zsh/molecule/default/tests/test_role.py
Normal file
50
roles/oh-my-zsh/molecule/default/tests/test_role.py
Normal file
@@ -0,0 +1,50 @@
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize('username', [
|
||||
'test_usr1',
|
||||
'test_usr2',
|
||||
'test_usr5',
|
||||
])
|
||||
def test_oh_my_zsh_install(host, username):
|
||||
oh_my_zsh = host.file('/home/' + username + '/.oh-my-zsh')
|
||||
assert oh_my_zsh.exists
|
||||
assert oh_my_zsh.is_directory
|
||||
assert oh_my_zsh.user == username
|
||||
assert oh_my_zsh.group in [username, 'users']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('username', [
|
||||
'test_usr3',
|
||||
'test_usr4',
|
||||
])
|
||||
def test_oh_my_zsh_is_not_installed_for_excluded_users(host, username):
|
||||
oh_my_zsh = host.file('/home/' + username + '/.oh-my-zsh')
|
||||
zshrc = host.file('/home/' + username + '/.zshrc')
|
||||
assert not oh_my_zsh.exists
|
||||
assert not zshrc.exists
|
||||
|
||||
|
||||
@pytest.mark.parametrize('username,theme,plugins', [
|
||||
('test_usr1', 'test_theme1', 'test_plugin1 test_plugin2'),
|
||||
('test_usr2', 'test_theme2', 'test_plugin3 test_plugin4'),
|
||||
])
|
||||
def test_oh_my_zsh_config(host, username, theme, plugins):
|
||||
zshrc = host.file('/home/' + username + '/.zshrc')
|
||||
assert zshrc.exists
|
||||
assert zshrc.is_file
|
||||
assert zshrc.user == username
|
||||
assert zshrc.group in [username, 'users']
|
||||
assert zshrc.contains(theme)
|
||||
assert zshrc.contains(plugins)
|
||||
|
||||
|
||||
def test_console_setup(host):
|
||||
# console-setup is Debian family specific
|
||||
if host.file('/etc/debian_version').exists:
|
||||
setup = host.file('/etc/default/console-setup')
|
||||
assert setup.exists
|
||||
assert setup.is_file
|
||||
assert setup.user == 'root'
|
||||
assert setup.group == 'root'
|
||||
assert setup.contains('CHARMAP="UTF-8"')
|
||||
Reference in New Issue
Block a user