changed no_auth to authentication_disabled in config
authorRodney Ewing <ewing.rj@gmail.com>
Tue, 11 Jun 2013 21:30:38 +0000 (14:30 -0700)
committerRodney Ewing <ewing.rj@gmail.com>
Tue, 11 Jun 2013 21:30:38 +0000 (14:30 -0700)
mediagoblin.ini
mediagoblin/app.py
mediagoblin/auth/tools.py
mediagoblin/tests/appconfig_context_modified.ini
mediagoblin/tests/appconfig_plugin_specs.ini
mediagoblin/tests/appconfig_static_plugin.ini
mediagoblin/tests/auth_configs/authentication_disabled_appconfig.ini [moved from mediagoblin/tests/auth_configs/no_auth_false_no_auth_plugin_appconfig.ini with 95% similarity]
mediagoblin/tests/auth_configs/no_auth_plugin_appconfig.ini [moved from mediagoblin/tests/auth_configs/no_auth_true_no_auth_plugin_appconfig.ini with 95% similarity]
mediagoblin/tests/test_auth.py
mediagoblin/tests/test_mgoblin_app.ini

index 4799b248e32ca9dc42738208b398c58dd94e41fe..d1fe4fd15487871bd5000a0e2dbf0513bbb02625 100644 (file)
@@ -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
index 575a38357bebd0df04d34d8b01c3b79b8b7740b2..f44504a7aa48a714696783f81577523182baf636 100644 (file)
@@ -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)
index ae0b79da722ce84779937ce038290b6fc4ca3b7e..29b0ac761dca696ddaffb0dd8603cd6bb627ccec 100644 (file)
@@ -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()
index 23efa3bd8f173ceb76cd2354ed7c20867eb6694e..251c083ca56474980f59cdb709f39a18668a73ad 100644 (file)
@@ -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"
index 2029aa81d72e0cb45c8822dd459f9013021313a0..686492577a22ed071ac87bfdbe977284ca90aa10 100644 (file)
@@ -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]]
index 053a77c15fb4de48a19249ffbff7da79d6fe40cf..dbb789e0d1ea349355bfe0be5633ebc8c0ef9195 100644 (file)
@@ -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"
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 49f9e9de1947757f18c8ea03a6b336a7027cd3b2..bbcb9163c5de10b720387f2341d1eccd9c7c2a53 100644 (file)
@@ -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"
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 5e6cfde6de9aa5562f3671ad40dae98235baea3a..87b3aab05d5095044ccc84f48471a3a10855bfee 100644 (file)
@@ -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"
index 8a828303b7ad5941ead23cf5a1dd6a34c2af4f77..9630305ae343cf62288d81bc4e36439ba9e838d3 100644 (file)
@@ -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?
index 180eea192ce54e023728732f01e95c58a6079948..6bd32b6917105df1f44717f949eef040c8ab110a 100644 (file)
@@ -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"