From 9754802d4bca036b8fb0b50db948dd2eb8f64bd6 Mon Sep 17 00:00:00 2001 From: Elrond Date: Thu, 1 Dec 2011 23:33:47 +0100 Subject: fixture_add_user: Factoring a unit test tool Some unit tests need a user in the database, especially to act as that user. Some routines did that on their own. So factored this whole thing into a new function and use it around. --- mediagoblin/tests/test_auth.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'mediagoblin/tests/test_auth.py') diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py index 153c6e53..acef3d26 100644 --- a/mediagoblin/tests/test_auth.py +++ b/mediagoblin/tests/test_auth.py @@ -20,7 +20,7 @@ import datetime from nose.tools import assert_equal from mediagoblin.auth import lib as auth_lib -from mediagoblin.tests.tools import setup_fresh_app +from mediagoblin.tests.tools import setup_fresh_app, fixture_add_user from mediagoblin import mg_globals from mediagoblin.tools import template, mail @@ -332,11 +332,7 @@ def test_authentication_views(test_app): Test logging in and logging out """ # Make a new user - test_user = mg_globals.database.User() - test_user['username'] = u'chris' - test_user['email'] = u'chris@example.com' - test_user['pw_hash'] = auth_lib.bcrypt_gen_password_hash('toast') - test_user.save() + test_user = fixture_add_user(active_user=False) # Get login # --------- -- cgit v1.2.3