fixtures.db module

fixtures.db.db(uses_db)[source]

Fixture providing utils.db.cfmedb

This is an SQLalchemy-based helper class which provides access to common database functions.

See also

http://www.sqlalchemy.org/ session.

Usage:

# This example gets vm names and hostnames from the ext_management_systems table.
def test_that_tries_for_db(db):
    ems_table = db['ext_management_systems']
    for instance in db.session.query(ems_table.order_by(ems_table.id):)
        assert instance.name, instance.hostname

This fixture is module scoped to ensure predictable database access at the module level within tests.

fixtures.db.db_yamls(db)[source]

Returns a mapping of database yaml names to the yaml contents serialized in python