From 5101c469d71286f00e1094ee82e7e15d707f91e4 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Tue, 11 Jun 2013 14:30:38 -0700 Subject: [PATCH] changed no_auth to authentication_disabled in config --- mediagoblin.ini | 2 +- mediagoblin/app.py | 2 +- mediagoblin/auth/tools.py | 12 +++++----- .../tests/appconfig_context_modified.ini | 2 +- mediagoblin/tests/appconfig_plugin_specs.ini | 2 +- mediagoblin/tests/appconfig_static_plugin.ini | 2 +- ... => authentication_disabled_appconfig.ini} | 2 +- ...onfig.ini => no_auth_plugin_appconfig.ini} | 2 +- mediagoblin/tests/test_auth.py | 22 +++++++++---------- mediagoblin/tests/test_mgoblin_app.ini | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-) rename mediagoblin/tests/auth_configs/{no_auth_false_no_auth_plugin_appconfig.ini => authentication_disabled_appconfig.ini} (95%) rename mediagoblin/tests/auth_configs/{no_auth_true_no_auth_plugin_appconfig.ini => no_auth_plugin_appconfig.ini} (95%) diff --git a/mediagoblin.ini b/mediagoblin.ini index 4799b248..d1fe4fd1 100644 --- a/mediagoblin.ini +++ b/mediagoblin.ini @@ -35,7 +35,7 @@ allow_registration = true # Set to true to run an instance with no authentication plugins enabled. # You will not be able to login or register -no_auth = false +authentication_disabled = false [storage:queuestore] base_dir = %(here)s/user_dev/media/queue diff --git a/mediagoblin/app.py b/mediagoblin/app.py index 575a3835..f44504a7 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -192,7 +192,7 @@ class MediaGoblinApp(object): request.urlgen = build_proxy - # Log user out if in no_auth mode + # Log user out if authentication_disabled no_auth_logout(request) mg_request.setup_user_in_request(request) diff --git a/mediagoblin/auth/tools.py b/mediagoblin/auth/tools.py index ae0b79da..29b0ac76 100644 --- a/mediagoblin/auth/tools.py +++ b/mediagoblin/auth/tools.py @@ -180,21 +180,21 @@ def check_login_simple(username, password): class AuthError(Exception): def __init__(self): - self.value = 'No Authentication Plugin is enabled and no_auth = false'\ - ' in config!' + self.value = 'No Authentication Plugin is enabled and' \ + ' authentication_disabled = false in config!' def __str__(self): return repr(self.value) def check_auth_enabled(): - no_auth = mg_globals.app_config['no_auth'] + authentication_disabled = mg_globals.app_config['authentication_disabled'] auth_plugin = hook_handle('authentication') - if no_auth == 'false' and not auth_plugin: + if authentication_disabled == 'false' and not auth_plugin: raise AuthError - if no_auth == 'true' and not auth_plugin: + if authentication_disabled == 'true': _log.warning('No authentication is enabled') return False else: @@ -202,7 +202,7 @@ def check_auth_enabled(): def no_auth_logout(request): - """Log out the user if in no_auth mode, but don't delete the messages""" + """Log out the user if authentication_disabled, but don't delete the messages""" if not mg_globals.app.auth and 'user_id' in request.session: del request.session['user_id'] request.session.save() diff --git a/mediagoblin/tests/appconfig_context_modified.ini b/mediagoblin/tests/appconfig_context_modified.ini index 23efa3bd..251c083c 100644 --- a/mediagoblin/tests/appconfig_context_modified.ini +++ b/mediagoblin/tests/appconfig_context_modified.ini @@ -2,7 +2,7 @@ direct_remote_path = /test_static/ email_sender_address = "notice@mediagoblin.example.org" email_debug_mode = true -no_auth = true +authentication_disabled = true # TODO: Switch to using an in-memory database sql_engine = "sqlite:///%(here)s/user_dev/mediagoblin.db" diff --git a/mediagoblin/tests/appconfig_plugin_specs.ini b/mediagoblin/tests/appconfig_plugin_specs.ini index 2029aa81..68649257 100644 --- a/mediagoblin/tests/appconfig_plugin_specs.ini +++ b/mediagoblin/tests/appconfig_plugin_specs.ini @@ -14,7 +14,7 @@ allow_registration = true # Set to true to run an instance with no authentication plugins enabled. # You will not be able to login or register -no_auth = true +authentication_disabled = false [plugins] [[mediagoblin.tests.testplugins.pluginspec]] diff --git a/mediagoblin/tests/appconfig_static_plugin.ini b/mediagoblin/tests/appconfig_static_plugin.ini index 053a77c1..dbb789e0 100644 --- a/mediagoblin/tests/appconfig_static_plugin.ini +++ b/mediagoblin/tests/appconfig_static_plugin.ini @@ -2,7 +2,7 @@ direct_remote_path = /test_static/ email_sender_address = "notice@mediagoblin.example.org" email_debug_mode = true -no_auth = true +authentication_disabled = true # TODO: Switch to using an in-memory database sql_engine = "sqlite:///%(here)s/user_dev/mediagoblin.db" diff --git a/mediagoblin/tests/auth_configs/no_auth_false_no_auth_plugin_appconfig.ini b/mediagoblin/tests/auth_configs/authentication_disabled_appconfig.ini similarity index 95% rename from mediagoblin/tests/auth_configs/no_auth_false_no_auth_plugin_appconfig.ini rename to mediagoblin/tests/auth_configs/authentication_disabled_appconfig.ini index 49f9e9de..bbcb9163 100644 --- a/mediagoblin/tests/auth_configs/no_auth_false_no_auth_plugin_appconfig.ini +++ b/mediagoblin/tests/auth_configs/authentication_disabled_appconfig.ini @@ -2,7 +2,7 @@ direct_remote_path = /test_static/ email_sender_address = "notice@mediagoblin.example.org" email_debug_mode = true -no_auth = false +authentication_disabled = true # TODO: Switch to using an in-memory database sql_engine = "sqlite:///%(here)s/user_dev/mediagoblin.db" diff --git a/mediagoblin/tests/auth_configs/no_auth_true_no_auth_plugin_appconfig.ini b/mediagoblin/tests/auth_configs/no_auth_plugin_appconfig.ini similarity index 95% rename from mediagoblin/tests/auth_configs/no_auth_true_no_auth_plugin_appconfig.ini rename to mediagoblin/tests/auth_configs/no_auth_plugin_appconfig.ini index 5e6cfde6..87b3aab0 100644 --- a/mediagoblin/tests/auth_configs/no_auth_true_no_auth_plugin_appconfig.ini +++ b/mediagoblin/tests/auth_configs/no_auth_plugin_appconfig.ini @@ -2,7 +2,7 @@ direct_remote_path = /test_static/ email_sender_address = "notice@mediagoblin.example.org" email_debug_mode = true -no_auth = true +authentication_disabled = false # TODO: Switch to using an in-memory database sql_engine = "sqlite:///%(here)s/user_dev/mediagoblin.db" diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py index 8a828303..9630305a 100644 --- a/mediagoblin/tests/test_auth.py +++ b/mediagoblin/tests/test_auth.py @@ -360,36 +360,36 @@ def test_authentication_views(test_app): assert urlparse.urlsplit(response.location)[2] == '/u/chris/' -# App with no_auth=false and no auth plugin enabled -def no_auth_false_no_auth_plugin_app(request): +# App with authentication_disabled and no auth plugin enabled +def no_auth_plugin_app(request): return get_app( request, mgoblin_config=pkg_resources.resource_filename( 'mediagoblin.tests.auth_configs', - 'no_auth_false_no_auth_plugin_appconfig.ini')) + 'no_auth_plugin_appconfig.ini')) -def test_no_auth_false_no_auth_plugin_raises(request): +def test_auth_plugin_raises(request): with pytest.raises(AuthError): - no_auth_false_no_auth_plugin_app(request) + no_auth_plugin_app(request) @pytest.fixture() -def no_auth_true_no_auth_plugin_app(request): +def authentication_disabled_app(request): return get_app( request, mgoblin_config=pkg_resources.resource_filename( 'mediagoblin.tests.auth_configs', - 'no_auth_true_no_auth_plugin_appconfig.ini')) + 'authentication_disabled_appconfig.ini')) -def test_no_auth_true_no_auth_plugin_app(no_auth_true_no_auth_plugin_app): +def test_authentication_disabled_app(authentication_disabled_app): # app.auth should = false assert mg_globals.app.auth is False # Try to visit register page template.clear_test_template_context() - response = no_auth_true_no_auth_plugin_app.get('/auth/register/') + response = authentication_disabled_app.get('/auth/register/') response.follow() # Correct redirect? @@ -398,7 +398,7 @@ def test_no_auth_true_no_auth_plugin_app(no_auth_true_no_auth_plugin_app): # Try to vist login page template.clear_test_template_context() - response = no_auth_true_no_auth_plugin_app.get('/auth/login/') + response = authentication_disabled_app.get('/auth/login/') response.follow() # Correct redirect? @@ -410,7 +410,7 @@ def test_no_auth_true_no_auth_plugin_app(no_auth_true_no_auth_plugin_app): # Try to visit the forgot password page template.clear_test_template_context() - response = no_auth_true_no_auth_plugin_app.get('/auth/register/') + response = authentication_disabled_app.get('/auth/register/') response.follow() # Correct redirect? diff --git a/mediagoblin/tests/test_mgoblin_app.ini b/mediagoblin/tests/test_mgoblin_app.ini index 180eea19..6bd32b69 100644 --- a/mediagoblin/tests/test_mgoblin_app.ini +++ b/mediagoblin/tests/test_mgoblin_app.ini @@ -2,7 +2,7 @@ direct_remote_path = /test_static/ email_sender_address = "notice@mediagoblin.example.org" email_debug_mode = true -no_auth = true +authentication_disabled = false # TODO: Switch to using an in-memory database sql_engine = "sqlite:///%(here)s/user_dev/mediagoblin.db" -- 2.25.1