The ironic.tests.base Module

The ironic.tests.base Module

Base classes for our unit tests.

Allows overriding of config for use of fakes, and some black magic for inline callbacks.

class ironic.tests.base.ReplaceModule(name, new_value)[source]

Bases: fixtures.fixture.Fixture

Replace a module with a fake module.

setUp()[source]
class ironic.tests.base.TestCase(*args, **kwds)[source]

Bases: oslotest.base.BaseTestCase

Test case base class for all unit tests.

assertJsonEqual(expected, observed)[source]

Asserts that 2 complex data structures are json equivalent.

assertNotificationEqual(notif_args, service, host, event_type, level)[source]

Asserts properties of arguments passed when creating a notification.

Parameters:
  • notif_args – dict of arguments notification instantiated with
  • service – expected service that emits the notification
  • host – expected host that emits the notification
  • event_type – expected value of EventType field of notification as a string
  • level – expected NotificationLevel
config(**kw)[source]

Override config options for a test.

path_get(project_file=None)[source]

Get the absolute path to a file. Used for testing the API.

Parameters:project_file – File whose path to return. Default: None.
Returns:path to the specified file, or path to project root.
setUp()[source]

Run before each test method to initialize test environment.

set_defaults(**kw)[source]

Set default values of config options.

exception ironic.tests.base.TestingException[source]

Bases: exceptions.Exception

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.