oslo_privsep.tests package

Submodules

oslo_privsep.tests.fixture module

class oslo_privsep.tests.fixture.UnprivilegedPrivsepFixture(context)

Bases: fixtures.fixture.Fixture

setUp()

Prepare the Fixture for use.

This should not be overridden. Concrete fixtures should implement _setUp. Overriding of setUp is still supported, just not recommended.

After setUp has completed, the fixture will have one or more attributes which can be used (these depend totally on the concrete subclass).

Raises

MultipleExceptions if _setUp fails. The last exception captured within the MultipleExceptions will be a SetupError exception.

Returns

None.

Changed in 1.3

The recommendation to override setUp has been reversed - before 1.3, setUp() should be overridden, now it should not be.

Changed in 1.3.1

BaseException is now caught, and only subclasses of Exception are wrapped in MultipleExceptions.

oslo_privsep.tests.test_capabilities module

class oslo_privsep.tests.test_capabilities.TestCapabilities(*args, **kwds)

Bases: oslotest.base.BaseTestCase

test_drop_all_caps_except(mock_capset)
test_drop_all_caps_except_error(mock_capset)
test_get_caps(mock_capget)
test_get_caps_error(mock_capget)
test_set_keepcaps(mock_prctl)
test_set_keepcaps_error(mock_prctl)

oslo_privsep.tests.test_comm module

class oslo_privsep.tests.test_comm.BufSock

Bases: object

recv(bufsize)
sendall(data)
shutdown(_flag)
class oslo_privsep.tests.test_comm.TestSerialization(*args, **kwds)

Bases: oslotest.base.BaseTestCase

assertSendable(value)
send(data)
setUp()

Hook method for setting up the test fixture before exercising it.

test_badobj()
test_bool()
test_bytes()
test_dict()
test_eof()
test_int()
test_list()
test_none()
test_tuple()
test_unicode()

oslo_privsep.tests.test_daemon module

class oslo_privsep.tests.test_daemon.ClientChannelTestCase(*args, **kwds)

Bases: oslotest.base.BaseTestCase

DICT = {'string_1': ('tuple_1', b'tuple_2'), b'byte_1': ['list_1', 'list_2']}
EXPECTED = {'byte_1': ['list_1', 'list_2'], 'string_1': ('tuple_1', b'tuple_2')}
setUp()

Hook method for setting up the test fixture before exercising it.

test_out_of_band_log_message()
test_out_of_band_not_log_message()
class oslo_privsep.tests.test_daemon.DaemonTest(*args, **kwds)

Bases: oslotest.base.BaseTestCase

test_drop_privs(mock_dropcaps, mock_keepcaps, mock_setgroups, mock_setgid, mock_setuid)
class oslo_privsep.tests.test_daemon.LogRecorder(logs, *args, **kwargs)

Bases: logging.Formatter

format(record)

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

class oslo_privsep.tests.test_daemon.LogTest(*args, **kwds)

Bases: oslo_privsep.tests.testctx.TestContextTestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_format_record()
test_priv_loglevel()
test_record_data()
exception oslo_privsep.tests.test_daemon.TestException

Bases: Exception

class oslo_privsep.tests.test_daemon.UnMonkeyPatch(*args, **kwds)

Bases: oslotest.base.BaseTestCase

test_un_monkey_patch()
class oslo_privsep.tests.test_daemon.WithContextTest(*args, **kwds)

Bases: oslo_privsep.tests.testctx.TestContextTestCase

test_unexported()
oslo_privsep.tests.test_daemon.undecorated()

oslo_privsep.tests.test_priv_context module

exception oslo_privsep.tests.test_priv_context.CustomError(code, msg)

Bases: Exception

class oslo_privsep.tests.test_priv_context.PrivContextTest(*args, **kwds)

Bases: oslo_privsep.tests.testctx.TestContextTestCase

test_helper_command()
test_helper_command_default()
test_helper_command_default_dirtoo()
test_init_known_contexts()
test_init_windows(mock_sys)
test_set_client_mode(mock_sys)
class oslo_privsep.tests.test_priv_context.RootwrapTest(*args, **kwds)

Bases: oslo_privsep.tests.testctx.TestContextTestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_getpid()
class oslo_privsep.tests.test_priv_context.SeparationTest(*args, **kwds)

Bases: oslo_privsep.tests.testctx.TestContextTestCase

test_client_mode()
test_getpid()
class oslo_privsep.tests.test_priv_context.SerializationTest(*args, **kwds)

Bases: oslo_privsep.tests.testctx.TestContextTestCase

test_basic_functionality()
test_raises_custom()
test_raises_standard()

oslo_privsep.tests.testctx module

class oslo_privsep.tests.testctx.TestContextTestCase(*args, **kwds)

Bases: oslotest.base.BaseTestCase

assertNotMyPid(pid)
setUp()

Hook method for setting up the test fixture before exercising it.

Module contents