Source code for fixtures.db

import pytest

import utils.db

[docs]def db(uses_db): """Fixture providing :py:attr:`utils.db.cfmedb` This is an SQLalchemy-based helper class which provides access to common database functions. See also: 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( assert, instance.hostname This fixture is module scoped to ensure predictable database access at the module level within tests. """ return utils.db.cfmedb().copy()
[docs]def db_yamls(db): """Returns a mapping of database yaml names to the yaml contents serialized in python""" return utils.db.db_yamls(db)