示例#1
0
文件: port_revert.py 项目: saacg/hil
    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()
示例#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()
示例#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()
示例#4
0
文件: database.py 项目: gsilvis/haas
def auth_context():
    with app.test_request_context():
        init_auth()
        yield
示例#5
0
def auth_context():
    with app.test_request_context():
        init_auth()
        yield
示例#6
0
文件: keystone.py 项目: 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()