X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=mediagoblin%2Ftests%2Ftest_basic_auth.py;h=3a42e40775172c69ec91bbe223363b13131f8b98;hb=74262351b7cfe382c8437f3440a652b49f96e453;hp=45deab7c5f3bf1754606bceb7b0067f5334d1e40;hpb=56c4ad89ebef32bd5a40c00d987811ce4501ce22;p=mediagoblin.git diff --git a/mediagoblin/tests/test_basic_auth.py b/mediagoblin/tests/test_basic_auth.py index 45deab7c..3a42e407 100644 --- a/mediagoblin/tests/test_basic_auth.py +++ b/mediagoblin/tests/test_basic_auth.py @@ -13,9 +13,10 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -import urlparse -from mediagoblin.db.models import User +import six.moves.urllib.parse as urlparse + +from mediagoblin.db.models import User, LocalUser from mediagoblin.plugins.basic_auth import tools as auth_tools from mediagoblin.tests.tools import fixture_add_user from mediagoblin.tools import template @@ -66,7 +67,9 @@ def test_bcrypt_gen_password_hash(): def test_change_password(test_app): """Test changing password correctly and incorrectly""" - test_user = fixture_add_user(password=u'toast') + test_user = fixture_add_user( + password=u'toast', + privileges=[u'active']) test_app.post( '/auth/login/', { @@ -85,7 +88,7 @@ def test_change_password(test_app): assert urlparse.urlsplit(res.location)[2] == '/edit/account/' # test_user has to be fetched again in order to have the current values - test_user = User.query.filter_by(username=u'chris').first() + test_user = LocalUser.query.filter(LocalUser.username==u'chris').first() assert auth_tools.bcrypt_check_password('123456', test_user.pw_hash) # test that the password cannot be changed if the given @@ -97,5 +100,5 @@ def test_change_password(test_app): 'new_password': '098765', }) - test_user = User.query.filter_by(username=u'chris').first() + test_user = LocalUser.query.filter(LocalUser.username==u'chris').first() assert not auth_tools.bcrypt_check_password('098765', test_user.pw_hash)