def setUpPloneSite(self, portal): session.current_session = session.BuilderSession() session.current_session.session = create_session() super(ContentFixtureLayer, self).setUpPloneSite(portal) portal.portal_languages.use_combined_language_codes = True portal.portal_languages.addSupportedLanguage('de-ch') if not DB_CACHE_MANAGER.is_loaded_from_cache(CACHE_GEVER_FIXTURE): sqlite_testing.create_tables() # Avoid circular imports: from opengever.testing.fixtures import OpengeverContentFixture setRequest(portal.REQUEST) self['fixture_lookup_table'] = OpengeverContentFixture()() setRequest(None) DB_CACHE_MANAGER.data['fixture_lookup_table'] = ( self['fixture_lookup_table']) DB_CACHE_MANAGER.dump_to_cache(self['zodbDB'], CACHE_GEVER_FIXTURE) else: DB_CACHE_MANAGER.apply_cache_fixes(CACHE_GEVER_FIXTURE) self['fixture_lookup_table'] = ( DB_CACHE_MANAGER.data['fixture_lookup_table']) # bumblebee should only be turned on on-demand with the feature flag. # if this assertion fails a profile in the fixture enables bumblebee, # or if was left on by mistake after fixture setup. assert not is_bumblebee_feature_enabled()
def setUpZope(self, app, configurationContext): super(ContentFixtureLayer, self).setUpZope(app, configurationContext) # Setting up the database, which creates a new engine, must happen after # opengever's ZCML is loaded in order to have engine creation event # handlers already registered, which enable support for rolling back # to savepoints. sqlite_testing.setup_memory_database() sqlite_testing.create_tables()
def setUpPloneSite(self, portal): session.current_session = session.BuilderSession() session.current_session.session = create_session() super(ContentFixtureLayer, self).setUpPloneSite(portal) portal.portal_languages.use_combined_language_codes = True portal.portal_languages.addSupportedLanguage('de-ch') if not DB_CACHE_MANAGER.is_loaded_from_cache(CACHE_GEVER_FIXTURE): sqlite_testing.create_tables() # Avoid circular imports: from opengever.testing.fixtures import OpengeverContentFixture setRequest(portal.REQUEST) self['fixture_lookup_table'] = OpengeverContentFixture()() setRequest(None) DB_CACHE_MANAGER.data['fixture_lookup_table'] = ( self['fixture_lookup_table']) DB_CACHE_MANAGER.dump_to_cache(self['zodbDB'], CACHE_GEVER_FIXTURE) else: DB_CACHE_MANAGER.apply_cache_fixes(CACHE_GEVER_FIXTURE) self['fixture_lookup_table'] = ( DB_CACHE_MANAGER.data['fixture_lookup_table'])