示例#1
0
    def setUp(self):
        from hil.ext.switches.mock import LOCAL_STATE
        self.LOCAL_STATE = LOCAL_STATE
        fail_on_log_warnings()

        # Configure HIL:
        config_testsuite()
        config_merge({
            'extensions': {
                'hil.ext.switches.mock': '',
                'hil.ext.obm.ipmi': '',
                'hil.ext.obm.mock': '',
                'hil.ext.network_allocators.null': None,
                'hil.ext.network_allocators.vlan_pool': '',
            },
            'hil.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 setUp(self):
        from hil.ext.switches.mock import LOCAL_STATE
        self.LOCAL_STATE = LOCAL_STATE
        fail_on_log_warnings()

        # Configure HIL:
        config_testsuite()
        config_merge({
            'extensions': {
                'hil.ext.switches.mock': '',
                'hil.ext.network_allocators.null': None,
                'hil.ext.network_allocators.vlan_pool': '',
            },
            'hil.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()
示例#3
0
文件: keystone.py 项目: vsemp/hil
def keystone_projects(keystone_project_uuids):
    """Add each of the projects to the HIL 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
文件: keystone.py 项目: CCI-MOC/hil
def keystone_projects(keystone_project_uuids):
    """Add each of the projects to the HIL 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()
示例#5
0
def auth_context():
    with app.test_request_context():
        init_auth()
        yield
示例#6
0
文件: database.py 项目: CCI-MOC/hil
def auth_context():
    """Run the test in a request context, after calling init_auth."""
    with app.test_request_context():
        init_auth()
        yield
示例#7
0
def auth_context():
    """Run the test in a request context, after calling init_auth."""
    with app.test_request_context():
        init_auth()
        yield
示例#8
0
文件: database.py 项目: shwsun/haas
def auth_context():
    with app.test_request_context():
        init_auth()
        yield