test_SELINUX Module

This file contains tests on SElinux

class test_SELINUX.TestSelinux[source]

Bases: object

getenforce()[source]

Returns current enforcing mode of SELinux

Returns:SElinux enforcing status
Return type:str
getenforce_conf()[source]

Returns current enforcing mode of SELinux from config file

Returns:SElinux enforcing status
Return type:str
is_enabled()[source]

Detects whether is SElinux enabled or not

Returns:SElinux status
Return type:bool
mode()[source]

Returns current SELINUX type/mode from config file

Returns:SElinux type
Return type:str
set_enforcing()[source]

Set Enforcing mode.

set_permissive()[source]

Set Permissive mode.

classmethod setup_class()[source]

This method saves the original enforcing mode for later restoring

classmethod teardown_class()[source]

This method restores previous enforcing mode.

test_enabled(is_enabled)[source]

Tests whether is SElinux enabled.

Parameters:enabled (bool) – Whether is Selinux enabled or not
Raises :AssertionError
test_enforcing(getenforce)[source]

Verifies whether SELinux is in ‘Enforcing’ state.

Parameters:getenforce (str) – Current enforcing status
Raises :AssertionError
test_enforcing_check(set_enforcing, getenforce)[source]

Flips SElinux into Enforcing mode. Checks if SElinux is in Enforcing mode.

Parameters:selinux_getenforce (str) – Current enforcing status
Raises :AssertionError
test_enforcing_from_config(getenforce_conf)[source]

Verifies whether SELinux is in ‘Enforcing’ state. Checks from config file

Parameters:getenforce_conf (str) – Current enforcing status
Raises :AssertionError
test_is_targeted(mode)[source]

Verifies whether SELinux is in ‘targeted’ mode.

Parameters:selinux_type (str) – SELinux mode (targeted)
Raises :AssertionError
test_permissive_check(set_permissive, getenforce)[source]

Flips SElinux into permissive mode. Checks if SElinux is in Permissive mode.

Parameters:selinux_getenforce (str) – Current enforcing status
Raises :AssertionError

Previous topic

test_RPMPackages Module

Next topic

test_SERVICES Module

This Page