def config(self, config_files): super(KcMasterSqlTestCase, self).config([ tests.dirs.etc('keystone.conf.sample'), tests.dirs.tests('test_overrides.conf'), tests.dirs.tests('backend_sql.conf')]) self.load_backends() self.engine = session.get_engine() sql.ModelBase.metadata.create_all(bind=self.engine)
def config(self, config_files): super(CompatTestCase, self).config(config_files) # FIXME(morganfainberg): Since we are running tests through the # controllers and some internal api drivers are SQL-only, the correct # approach is to ensure we have the correct backing store. The # credential api makes some very SQL specific assumptions that should # be addressed allowing for non-SQL based testing to occur. self.load_backends() self.engine = session.get_engine() self.addCleanup(session.cleanup) self.addCleanup(sql.ModelBase.metadata.drop_all, bind=self.engine) sql.ModelBase.metadata.create_all(bind=self.engine)
def setUp(self): super(SqlTests, self).setUp() self.config([tests.dirs.etc('keystone.conf.sample'), tests.dirs.tests('test_overrides.conf'), tests.dirs.tests('backend_sql.conf')]) self.load_backends() # create tables and keep an engine reference for cleanup. # this must be done after the models are loaded by the managers. self.engine = session.get_engine() sql.ModelBase.metadata.create_all(bind=self.engine) # populate the engine with tables & fixtures self.load_fixtures(default_fixtures) #defaulted by the data load self.user_foo['enabled'] = True
def setUp(self): super(SqlTests, self).setUp() self.config([ tests.dirs.etc('keystone.conf.sample'), tests.dirs.tests('test_overrides.conf'), tests.dirs.tests('backend_sql.conf') ]) self.load_backends() # create tables and keep an engine reference for cleanup. # this must be done after the models are loaded by the managers. self.engine = db_session.get_engine() self.addCleanup(db_session.cleanup) sql.ModelBase.metadata.create_all(bind=self.engine) self.addCleanup(sql.ModelBase.metadata.drop_all, bind=self.engine) # populate the engine with tables & fixtures self.load_fixtures(default_fixtures) #defaulted by the data load self.user_foo['enabled'] = True
def load_backends(self): """Initializes each manager and assigns them to an attribute.""" # TODO(blk-u): Shouldn't need to clear the registry here, but some # tests call load_backends multiple times. These should be fixed to # only call load_backends once. dependency.reset() # TODO(morganfainberg): Shouldn't need to clear the registry here, but # some tests call load_backends multiple times. Since it is not # possible to re-configure a backend, we need to clear the list. This # should eventually be removed once testing has been cleaned up. kvs_core.KEY_VALUE_STORE_REGISTRY.clear() self.clear_auth_plugin_registry() drivers = service.load_backends() # TODO(stevemar): currently, load oauth1 driver as well, eventually # we need to have this as optional. from keystone.contrib import oauth1 drivers['oauth1_api'] = oauth1.Manager() from keystone.contrib import federation drivers['federation_api'] = federation.Manager() dependency.resolve_future_dependencies() for manager_name, manager in six.iteritems(drivers): setattr(self, manager_name, manager) # The credential backend only supports SQL, so we always have to load # the tables. self.engine = session.get_engine() self.addCleanup(session.cleanup) sql.ModelBase.metadata.create_all(bind=self.engine) self.addCleanup(sql.ModelBase.metadata.drop_all, bind=self.engine)