From c180b00c031192afa5e7e5a11e33c8fa038a8557 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Fri, 21 Jul 2023 00:02:02 +0200 Subject: [PATCH] remove python tests --- molecule/default/tests/conftest.py | 22 -------------- molecule/default/tests/test_default.py | 30 ------------------- molecule/with_custom_ascii/tests/conftest.py | 22 -------------- .../with_custom_ascii/tests/test_default.py | 28 ----------------- 4 files changed, 102 deletions(-) delete mode 100644 molecule/default/tests/conftest.py delete mode 100644 molecule/default/tests/test_default.py delete mode 100644 molecule/with_custom_ascii/tests/conftest.py delete mode 100644 molecule/with_custom_ascii/tests/test_default.py diff --git a/molecule/default/tests/conftest.py b/molecule/default/tests/conftest.py deleted file mode 100644 index f7ddb3f..0000000 --- a/molecule/default/tests/conftest.py +++ /dev/null @@ -1,22 +0,0 @@ -"""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 - ) diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py deleted file mode 100644 index ee590ba..0000000 --- a/molecule/default/tests/test_default.py +++ /dev/null @@ -1,30 +0,0 @@ -"""Role testing files using testinfra.""" - - -def test_hosts_file(host): - """Validate /etc/hosts file.""" - etc_hosts = host.file("/etc/hosts") - assert etc_hosts.exists - assert etc_hosts.user == "root" - assert etc_hosts.group == "root" - -def test_motd_file(host): - """Validate motd.cfg file.""" - motd_cfg = host.file("/etc/profile.d/motd.cfg") - dist_os = host.system_info.distribution - assert motd_cfg.exists - assert motd_cfg.user == "root" - assert motd_cfg.group == "root" - assert motd_cfg.mode == 0o644 - assert motd_cfg.contains("print_info()") - assert motd_cfg.contains("ascii_distro=\"" + dist_os + "_small\"") - -def test_motd_file(host): - """Validate 00-motd-neofetch file.""" - motd_neofetch = host.file("/etc/update-motd.d/00-motd-neofetch") - assert motd_neofetch.exists - assert motd_neofetch.user == "root" - assert motd_neofetch.group == "root" - assert motd_neofetch.mode == 0o744 - assert motd_neofetch.contains("#! /bin/sh") - assert motd_neofetch.contains("neofetch --config /etc/profile.d/motd.cfg") \ No newline at end of file diff --git a/molecule/with_custom_ascii/tests/conftest.py b/molecule/with_custom_ascii/tests/conftest.py deleted file mode 100644 index f7ddb3f..0000000 --- a/molecule/with_custom_ascii/tests/conftest.py +++ /dev/null @@ -1,22 +0,0 @@ -"""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 - ) diff --git a/molecule/with_custom_ascii/tests/test_default.py b/molecule/with_custom_ascii/tests/test_default.py deleted file mode 100644 index c2e6fb3..0000000 --- a/molecule/with_custom_ascii/tests/test_default.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Role testing files using testinfra.""" - - -def test_hosts_file(host): - """Validate /etc/hosts file.""" - etc_hosts = host.file("/etc/hosts") - assert etc_hosts.exists - assert etc_hosts.user == "root" - assert etc_hosts.group == "root" - -def test_motd_file(host): - """Validate motd.cfg file.""" - motd_cfg = host.file("/etc/profile.d/motd.cfg") - assert motd_cfg.exists - assert motd_cfg.user == "root" - assert motd_cfg.group == "root" - assert motd_cfg.mode == 0o644 - assert motd_cfg.contains("print_info()") - -def test_motd_file(host): - """Validate 00-motd-neofetch file.""" - motd_neofetch = host.file("/etc/update-motd.d/00-motd-neofetch") - assert motd_neofetch.exists - assert motd_neofetch.user == "root" - assert motd_neofetch.group == "root" - assert motd_neofetch.mode == 0o744 - assert motd_neofetch.contains("#! /bin/sh") - assert motd_neofetch.contains("neofetch --config /etc/profile.d/motd.cfg") \ No newline at end of file