Example #1
0
    def setUp(self):
        from haas.ext.switches.mock import LOCAL_STATE
        self.LOCAL_STATE = LOCAL_STATE
        fail_on_log_warnings()

        # Configure HaaS:
        config_testsuite()
        config_merge({
            'extensions': {
                'haas.ext.switches.mock': '',
                'haas.ext.obm.ipmi': '',
                'haas.ext.obm.mock': '',
                'haas.ext.network_allocators.null': None,
                'haas.ext.network_allocators.vlan_pool': '',
            },
            'haas.ext.network_allocators.vlan_pool': {
                'vlans': '100-200',
            },
        })
        config.load_extensions()

        newDB()  # Initialize the db schema
        initial_db()  # Populate the db with objects

        # Sanity check the start state:
        assert self.LOCAL_STATE['stock_switch_0']['free_port_0'] == {}

        self.request_context = app.test_request_context()
        self.request_context.push()
Example #2
0
def keystone_projects(keystone_project_uuids):
    """Add each of the projects to the HaaS database.

    keystone_project_uuids is the return value from the fixture of the same
    name.
    """
    with app.test_request_context():
        for name in ('admin', 'service'):
            model.db.session.add(model.Project(keystone_project_uuids[name]))
        model.db.session.commit()
Example #3
0
def keystone_projects(keystone_project_uuids):
    """Add each of the projects to the HaaS database.

    keystone_project_uuids is the return value from the fixture of the same
    name.
    """
    with app.test_request_context():
        for name in ('admin', 'service'):
            model.db.session.add(model.Project(keystone_project_uuids[name]))
        model.db.session.commit()
Example #4
0
def auth_context():
    with app.test_request_context():
        init_auth()
        yield
Example #5
0
def auth_context():
    with app.test_request_context():
        init_auth()
        yield
Example #6
0
File: keystone.py Project: henn/hil
def keystone_projects(keystone_project_uuids):
    with app.test_request_context():
        for name in ('admin', 'service'):
            model.db.session.add(model.Project(keystone_project_uuids[name]))
        model.db.session.commit()