The openstack_dashboard.test.test_data.utils ModuleΒΆ

class openstack_dashboard.test.test_data.utils.TestData(*args)[source]

Bases: object

Holder object for test data. Any functions passed to the init method will be called with the TestData object as their only argument. They can then load data onto the object as desired.

The idea is to use the instantiated object like this:

>>> import glance_data
>>> TEST = TestData(glance_data.data)
>>> TEST.images.list()
[<Image: visible_image>, <Image: invisible_image>]
>>> TEST.images.first()
<Image: visible_image>

You can load as little or as much data as you like as long as the loaders don’t conflict with each other.

See the TestDataContainer class for a list of available methods.

class openstack_dashboard.test.test_data.utils.TestDataContainer[source]

Bases: object

A container for test data objects.

The behavior of this class is meant to mimic a “manager” class, which has convenient shortcuts for common actions like “list”, “filter”, “get”, and “add”.

TestDataContainer.add(*args)[source]

Add a new object to this container.

Generally this method should only be used during data loading, since adding data during a test can affect the results of other tests.

TestDataContainer.count()[source]
TestDataContainer.filter(filtered=None, **kwargs)[source]

Returns objects in this container whose attributes match the given keyword arguments.

TestDataContainer.first()[source]

Returns the first object from this container.

TestDataContainer.get(**kwargs)[source]

Returns the single object in this container whose attributes match the given keyword arguments. An error will be raised if the arguments provided don’t return exactly one match.

TestDataContainer.list()[source]

Returns a list of all objects in this container.

openstack_dashboard.test.test_data.utils.load_test_data(load_onto=None)[source]

Previous topic

The openstack_dashboard.test.test_data.keystone_data Module

Next topic

The openstack_dashboard.test.test_data.neutron_data Module

This Page