From 30520c92cc621bd0826259aca3d9b7b740f71ef0 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Sat, 15 Sep 2012 17:54:34 +0200 Subject: [PATCH] Fixed tests - Adapt tests to new global_config arg for run_dbupdate - Account for [plugins] not being set in config --- mediagoblin/db/sql/open.py | 2 +- mediagoblin/gmg_commands/dbupdate.py | 2 +- mediagoblin/tests/tools.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mediagoblin/db/sql/open.py b/mediagoblin/db/sql/open.py index 95691b2c..9db21c56 100644 --- a/mediagoblin/db/sql/open.py +++ b/mediagoblin/db/sql/open.py @@ -56,7 +56,7 @@ def load_models(app_config): _log.debug("Loading %s.models", media_type) __import__(media_type + ".models") - for plugin in mg_globals.global_config['plugins'].keys(): + for plugin in mg_globals.global_config.get('plugins', {}).keys(): _log.debug("Loading %s.models", plugin) try: __import__(plugin + ".models") diff --git a/mediagoblin/gmg_commands/dbupdate.py b/mediagoblin/gmg_commands/dbupdate.py index 12329b54..67fdd69c 100644 --- a/mediagoblin/gmg_commands/dbupdate.py +++ b/mediagoblin/gmg_commands/dbupdate.py @@ -111,7 +111,7 @@ def run_dbupdate(app_config, global_config): # Gather information from all media managers / projects dbdatas = gather_database_data( app_config['media_types'], - global_config['plugins'].keys()) + global_config.get('plugins', {}).keys()) # Set up the database connection, db = setup_connection_and_db_from_config(app_config) diff --git a/mediagoblin/tests/tools.py b/mediagoblin/tests/tools.py index a40569e4..6fd11fc2 100644 --- a/mediagoblin/tests/tools.py +++ b/mediagoblin/tests/tools.py @@ -134,7 +134,7 @@ def get_test_app(dump_old_app=True): app_config = global_config['mediagoblin'] # Run database setup/migrations - run_dbupdate(app_config) + run_dbupdate(app_config, global_config) # setup app and return test_app = loadapp( -- 2.25.1