def create_api_models(bus): """Create all the API models and return as a dictionary for DSE2.""" res = {} res['api-policy'] = policy_model.PolicyModel('api-policy', bus=bus) res['api-rule'] = rule_model.RuleModel('api-rule', bus=bus) res['api-row'] = row_model.RowModel('api-row', bus=bus) res['api-datasource'] = datasource_model.DatasourceModel('api-datasource', bus=bus) res['api-schema'] = schema_model.SchemaModel('api-schema', bus=bus) res['api-table'] = table_model.TableModel('api-table', bus=bus) res['api-status'] = status_model.StatusModel('api-status', bus=bus) res['api-action'] = action_model.ActionsModel('api-action', bus=bus) res['api-system'] = driver_model.DatasourceDriverModel('api-system', bus=bus) return res
def setUp(self): super(TestStatusModel, self).setUp() # Here we load the fake driver cfg.CONF.set_override( 'drivers', ['congress.tests.fake_datasource.FakeDataSource']) # NOTE(arosen): this set of tests, tests to deeply. We don't have # any tests currently testing cage. Once we do we should mock out # cage so we don't have to create one here. self.cage = harness.create(helper.root_path(), helper.state_path()) self.datasource_mgr = datasource_manager.DataSourceManager self.datasource_mgr.validate_configured_drivers() req = {'driver': 'fake_datasource', 'name': 'fake_datasource'} req['config'] = {'auth_url': 'foo', 'username': '******', 'password': '******', 'tenant_name': 'foo'} self.datasource = self.datasource_mgr.add_datasource(req) engine = self.cage.service_object('engine') self.status_model = status_model.StatusModel("status_schema", {}, policy_engine=engine)