From fa7232913c42fe242e07060f0f42ff546f6d68cc Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Wed, 15 May 2013 15:56:05 -0700 Subject: [PATCH] modified test .ini files and changed tests to use basic_auth bcrypt --- mediagoblin/tests/appconfig_context_modified.ini | 1 + mediagoblin/tests/appconfig_plugin_specs.ini | 4 ++++ mediagoblin/tests/test_edit.py | 3 ++- mediagoblin/tests/test_mgoblin_app.ini | 2 ++ mediagoblin/tests/tools.py | 4 ++-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/mediagoblin/tests/appconfig_context_modified.ini b/mediagoblin/tests/appconfig_context_modified.ini index 80ca69b1..23efa3bd 100644 --- a/mediagoblin/tests/appconfig_context_modified.ini +++ b/mediagoblin/tests/appconfig_context_modified.ini @@ -2,6 +2,7 @@ direct_remote_path = /test_static/ email_sender_address = "notice@mediagoblin.example.org" email_debug_mode = true +no_auth = 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 5511cd97..2029aa81 100644 --- a/mediagoblin/tests/appconfig_plugin_specs.ini +++ b/mediagoblin/tests/appconfig_plugin_specs.ini @@ -12,6 +12,10 @@ email_debug_mode = true # Set to false to disable registrations 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 + [plugins] [[mediagoblin.tests.testplugins.pluginspec]] some_string = "not blork" diff --git a/mediagoblin/tests/test_edit.py b/mediagoblin/tests/test_edit.py index 08b4f8cf..ccdf9c29 100644 --- a/mediagoblin/tests/test_edit.py +++ b/mediagoblin/tests/test_edit.py @@ -21,7 +21,8 @@ from mediagoblin import mg_globals from mediagoblin.db.models import User from mediagoblin.tests.tools import fixture_add_user from mediagoblin.tools import template -from mediagoblin.auth.lib import bcrypt_check_password +from mediagoblin.plugins.basic_auth.lib import bcrypt_check_password + class TestUserEdit(object): def setup(self): diff --git a/mediagoblin/tests/test_mgoblin_app.ini b/mediagoblin/tests/test_mgoblin_app.ini index 0466b53b..180eea19 100644 --- a/mediagoblin/tests/test_mgoblin_app.ini +++ b/mediagoblin/tests/test_mgoblin_app.ini @@ -2,6 +2,7 @@ direct_remote_path = /test_static/ email_sender_address = "notice@mediagoblin.example.org" email_debug_mode = true +no_auth = true # TODO: Switch to using an in-memory database sql_engine = "sqlite:///%(here)s/user_dev/mediagoblin.db" @@ -31,3 +32,4 @@ BROKER_HOST = "sqlite:///%(here)s/user_dev/kombu.db" [[mediagoblin.plugins.oauth]] [[mediagoblin.plugins.httpapiauth]] [[mediagoblin.plugins.piwigo]] +[[mediagoblin.plugins.basic_auth]] diff --git a/mediagoblin/tests/tools.py b/mediagoblin/tests/tools.py index 2ee39e89..35c2c3e9 100644 --- a/mediagoblin/tests/tools.py +++ b/mediagoblin/tests/tools.py @@ -31,7 +31,7 @@ from mediagoblin.tools import testing from mediagoblin.init.config import read_mediagoblin_config from mediagoblin.db.base import Session from mediagoblin.meddleware import BaseMeddleware -from mediagoblin.auth.lib import bcrypt_gen_password_hash +from mediagoblin.auth import gen_password_hash from mediagoblin.gmg_commands.dbupdate import run_dbupdate @@ -179,7 +179,7 @@ def fixture_add_user(username=u'chris', password=u'toast', test_user.username = username test_user.email = username + u'@example.com' if password is not None: - test_user.pw_hash = bcrypt_gen_password_hash(password) + test_user.pw_hash = gen_password_hash(password) if active_user: test_user.email_verified = True test_user.status = u'active' -- 2.25.1