The cinder.test
Module¶
Base classes for our unit tests.
Allows overriding of CONF for use of fakes, and some black magic for inline callbacks.
-
class
Database
(db_api, db_migrate, sql_connection, sqlite_db, sqlite_clean_db)¶ Bases:
fixtures.fixture.Fixture
-
setUp
()¶
-
-
class
TestCase
(*args, **kwargs)¶ Bases:
testtools.testcase.TestCase
Test case base class for all unit tests.
-
assertDictMatch
(d1, d2, approx_equal=False, tolerance=0.001)¶ Assert two dicts are equivalent.
This is a ‘deep’ match in the sense that it handles nested dictionaries appropriately.
NOTE:
If you don’t care (or don’t know) a given value, you can specify the string DONTCARE as the value. This will cause that dict-item to be skipped.
-
flags
(**kw)¶ Override CONF variables for a test.
-
mock_object
(obj, attr_name, new_attr=None, **kwargs)¶ Use python mock to mock an object attribute
Mocks the specified objects attribute with the given value. Automatically performs ‘addCleanup’ for the mock.
-
override_config
(name, override, group=None)¶ Cleanly override CONF variables.
-
setUp
()¶ Run before each test method to initialize test environment.
-
start_service
(name, host=None, **kwargs)¶
-
-
exception
TestingException
¶ Bases:
exceptions.Exception