validations_common.tests.callback_plugins.test_fail_if_no_hosts module

test_fail_if_no_hosts

Tests for fail_if_no_hosts callback plugin.

class validations_common.tests.callback_plugins.test_fail_if_no_hosts.TestFailIfNoHosts(*args: Any, **kwargs: Any)[source]

Bases: validations_common.tests.base.TestCase

setUp()[source]
test_callback_instantiation()[source]

Verifying that the CallbackModule is instantiated properly.

Test checks presence of CallbackBase in the inheritance chain, in order to ensure that

test_callback_playbook_on_stats_no_hosts(mock_exit)[source]

Following test concerns stats, an instance of AggregateStats and how it’s processed by the callback.

When the v2_playbook_on_stats method of the callback is called, a number of hosts in the stats.processed dictionary is checked. If there are no hosts in the stats.processed dictionary, the callback calls sys.exit.

test_callback_playbook_on_stats_some_hosts(mock_exit)[source]

Following test concerns stats, an instance of AggregateStats and how it’s processed by the callback.

When the v2_playbook_on_stats method of the callback is called, a number of hosts in the stats.processed dictionary is checked. If there are hosts in the stats.processed dictionary, sys.exit is never called.